Following the standard convention, I keep my source codes and unit tests in separate folders. I follow the same package structure when creating the test.
For example, if a package com.kshitizhas a class OrderGeneratorin a folder src, my unit test will be OrderGeneratorTestin com.kshitiza folder test.
In my current installation, this type of organization becomes unmanageable after a while. I can not write unit tests before the code. Some other developer is responsible for writing the code, and I have to follow the test cases. (Yes, I know that everything should be the other way around, but I canโt help)
Since test cases are written second, I have to go through all the packages that look for classes and look for methods in these classes to make sure that I have a test for them. With 100 classes and thousands of methods, this is pretty painful.
Is there a way to make sure that the coverage of your test case matches the code? Is there an easy way to find classes that don't have a matching test case?
I use Java, Eclipse and Junit 4.
source
share