I'm having trouble running a Parameterized
Groovy JUnit test-case in Eclipse (see below for test code and environment details).
Symptoms
- Right-clicking on the class in Package Explorer and doing Run As -> JUnit Test Case just brings up a dialog claiming "No JUnit tests found".
- Right-clicking on the project and doing Run As -> JUnit Test Case runs all test-cases except the parameterized Groovy one.
Things I've tried
- Ensuring a "normal" Groovy JUnit test-case runs. This works.
- Ensuring a parameterized Java test-case runs. This works.
- Manually creating a JUnit run configuration for this test-case. This works.
So
So I have an inconvenient workaround (3). But this isn't scalable, as this test-case still won't be included when I run all test-cases in the project.
Any ideas how I can get Eclipse/Groovy plugin/JUnit to automatically recognise my test-case?
Test-case code
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
@RunWith(Parameterized)
public class TestParams {
final int a
public TestParams(int a) { this.a = a }
@Parameters
public static Collection<Object[]> data() {
def cases = new Object[2][1]
cases[0][0] = 3
cases[1][0] = 4
Arrays.asList(cases)
}
@Test public void test() { println "a = $a" }
}
Environment
- Eclipse Juno Service Release 2 (OSX)
- Groovy-Eclipse 2.8.0
- JUnit 4.10.0