Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should unit test classes be kept under version control with the rest of the code?

If I create a test suite for a development project, should those classes be kept under version control with the rest of the project code?

like image 766
devonmallory Avatar asked Sep 22 '08 14:09

devonmallory


People also ask

Should unit tests be in the same package?

Unit tests can be in any package. In essence they are just separate classes used to test the behaviour of the class being tested.

Where should the unit test reside in the repository?

The developers should write unit tests alongside the source code and execute them in pipelines. Separating the repositories keeps more clean environment. Repositories contain only things it's concerned about.

Should tests be part of source code?

Testing the quality of the source code is an essential step that does not allow for failure.

What do you have to avoid in tests in unit testing?

Avoid Test Interdependence You, therefore, cannot count on the test suite or the class that you're testing to maintain state in between tests. But that won't always make itself obvious to you. If you have two tests, for instance, the test runner may happen to execute them in the same order each time.


1 Answers

Yes, there is no reason not to put them in source control. What if the tests change? What if the interfaces change, necessitating that the tests change?

like image 157
Adam Rosenfield Avatar answered Sep 18 '22 14:09

Adam Rosenfield