Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
another unit-test question

another unit-test question

2003-03-04       - By Erik Price
Reply:     1     2     3     4     5     6     7     8  

I have one other question (where I am uncertain of the "best practice").
 Following along in "Java Development with Ant", in the context of
using JUnit for unit testing.

It is recommended to keep test code separate from production code in the
filesystem, using unique directory trees.  This makes sense, because you
want to be able to easily copy or access your production code without
filtering through files ending with "*Test.java".  But if you don't put
the test code in with the production code, how can they share the same
package?  It seems to be recommended that unit tests share the same
package as the code that they are testing (this is also evident in the
example in the book, in which "HtmlDocumentTest" [a unit test] is
declared to be in the same package as the production code).

Should I be copying my production code source tree into a new tree with
the test code embedded alongside it?  If so then what happens when I
make a change to the source code, I have to first copy it into the test
tree so that I can run the unit tests again?

Sorry, it's a little confusing to me.


Erik



©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.