As a matter of fact you have smth like /java/src
and /java/test
. But then, how do you name packages/classes the unittests go to? The same as classes they are written against? And when refactoring comes, do you manually rename in /test? Please share your experience.
views:
145answers:
2
+2
A:
I keep the tests in the same package as the class they are testing. This allows me to setup tests using package private members (when required). It also provides a nice, easy to remember convention. When I refactor, I usually do manually refactor the corresponding test classes. There was some IDE a while back that had the ability to do this refactoring automatically, but I can't remember it off the top of my head.
Daniel Spiewak
2008-10-11 05:52:01
+1
A:
In Java, keeping them in the same package as the class being tested, is a must. It's the only way to test methods with default/package-protected visibility.
trenton
2008-10-11 06:02:06