aspose file tools*
The moose likes Testing and the fly likes A better way to run all the JUnit tests within Ant? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "A better way to run all the JUnit tests within Ant?" Watch "A better way to run all the JUnit tests within Ant?" New topic
Author

A better way to run all the JUnit tests within Ant?

Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 433
I'm looking for a better way to run *ALL* the tests within Ant. I'm doing it with a name pattern match way. The name of the class ending with Test will be included in the batchtest. It has a problem, someone might check-in some class named with *Test, which is not a JUnit test indeed. I've read some documents about TestSuite, the problem is I have to update it whenever a new test is added.

Do you have better ways to do this job?

Thanks.


To be or not to be. It's a question.
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

The conventions say that all class names with they keyword test within them are to be considered as TestCases. Maven also works in the same manner. It matched the pattern of the className and looks for Test in the name of each class. So I suggest that you decide a convention on what type of class names are to be used in your application.


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Tim Cooke
Bartender

Joined: Mar 28, 2008
Posts: 1003
    
  47

I second that notion. It is a generally accepted convention that only unit test classes end with the word Test. Trying to configure some custom way to cherry pick particular classes to run as tests does not sound like a very maintainable approach. It'll be quite a cognitive load to remember how it works, and then to communicate to the rest of your team, and keep that communication going to future teams.

Just stick with the currently accepted convention.


Tim Driven Development
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A better way to run all the JUnit tests within Ant?