Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create a new suit with only selected tests from other suite

 
Swapnil Sapar
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been searching abt this for a while now. Could not find any good answer.
I'm using JUnit 4.8.1 but can go to JUnit 3 if I have too.

Here is my problem:

I have 3 test suites each containing 11, 12, 13 tests in it. CarTestSuite, CycleTestSuite, BoatTestSuite
Now I wish to create a new suite SanityReverseTestSuite containing only 3 tests. These tests are handpicked from the each of the above suites.
I know one I include all 3 suites into one using @Suite.SuiteClasses annotation but it would include *ALL* tests from these suite whereas I'm looking for including only ONE test from each of these suite.
Any tips/suggestions?



Cheers!
Swapnil

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34372
345
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JUnit 3.8, you just need create a suite as shown in the JavaDoc:


I don't know of a way to do what you want in JUnit 4 other than by extending JUnit itself. It would be easier to refactor the tests to be in different classes though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic