mercredi 16 mai 2018

Where to put integration tests in a Go project?

I'm working on a project that contains multiple folders (packages). Each package has files with code, and these files have unit test named filename_test.go. These packages are independent, and the tests located in each one of them do not rely on other packages.

Unit tests are not enough, and now I need to write integration tests between these packages. I don't know where to put them. They don't belong to any of the packages, so putting them under any folder will be wrong: they test multiple folders. I also don't know how to name these test files and the tests inside them.

I saw this question, which asks for a way to run unit and integration tests separately. This is great, and I will use it, once I find a correct, conventional way to write integration tests in my Go project.

So, the question is: given a project with multiple independent packages, where should integration tests be placed and how should they be named (file names and function names), according to Go conventions?

Aucun commentaire:

Enregistrer un commentaire