Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Cooke
Sheriff
Pie
Posts: 2980
123
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic