best place for junit testcase classes

best place for junit testcase classes

Postby javalatte » Mon Feb 25, 2013 4:31 am

When you write your junit test classes for your classes that you develop, do you place them under the same package as your classes? what is the commonly practiced convention? For example, if HelloWorld.java is under package javatrng.examples, then should you place HelloWorldTest.java also under javatrng.examples?
javalatte
 
Posts: 55
Joined: Tue Jan 29, 2013 2:31 pm

Re: best place for junit testcase classes

Postby Kishan » Thu Mar 14, 2013 12:03 pm

1) Create separate source folders for application code and test code.
Example: In maven projects application code sits in src/main/java and test code sits in src/test/java

2) When you are writing test class for application class better have to same package name for both the classes for ease of maintenance and understanding and accessibility.
Kishan
 
Posts: 191
Joined: Tue Jan 29, 2013 4:21 am


Return to JUNIT

Who is online

Users browsing this forum: No registered users and 1 guest

cron