tags:

views:

343

answers:

2

I have

@RunWith(Suite.class)
 @Suite.SuiteClasses( [ 
     First.class,Second.class
 ])
 public class MySuite{

}

But eclipse doesn't give me a "Run As Junit4 Test". All the individual test classes work fine with GUnit, the groovy unit test runner built into eclipse.

Any thoughts?

A: 

@Suite.SuiteClasses accepts Class[] as its parameter.

You may try:

@RunWith(Suite.class)
 @Suite.SuiteClasses( [ First.class,Second.class ] as Class[])
 public class MySuite{

}
chanwit
Thanks but no such luck. The "as Class[]" part doesn't parse right. It thinks its another thing passed to SuiteClasses and the compiler says that only Classes can be passed to SuiteClasses.
John Russell
+1  A: 

The only way I found to do this was to create a java class with a @Suite.SuiteClasses annotation as usual. You can put in the .class names of the Groovy classes you have for tests and it works well.

Kind of lame if you don't already have some java code to do it this way but I had a mix of Java and Groovy so it wasn't as big a deal.

The other option is to not use Suites at all and to use name patterns to find and run tests. Both ant and maven support this sort of pattern matching. I find it much easier than making sure I keep the suites up to date and Eclipse can just run all tests in a package if I want to do that.

Thanks for the help.

John Russell