vendredi 4 septembre 2015

Right structure of tests files when used ginkgo/gomega for testing Go app

My Go app(restfull api service) is growing and i decided to use testing. My choise is Ginkgo/Gomega.

Learning site (http://ift.tt/1Ogs7CL) i found that to start test you need

  1. goto the package
  2. ginkgo bootstrap

This will create file [your_package]_suite_test in root of package folder. It's Ok.

But then if i want to test some feature or file or package i need again goto the folder and ginkgo generate [test_name] which will create stub test file here.

So, in one moment we will have many messy: files of our app and testing files together in one folder. For example, server.go, server_test.go, auth.go, auth_test.go, and so on.

I want to searate app files and test files. For example i want to create a folder tests in root package and place all tests here. So, when i need to test app i can run go test ./tests

Is it correct pattern to use Ginkgo/Gomega with separate tests folder?

Thanks.

Aucun commentaire:

Enregistrer un commentaire