I am attempting to get the Jersey test framework working. We are building using maven 1.x. I’ve created the following testcase…
public class SomeResourceTest extends JerseyTest
{
public SomeResourceTest () throws Exception
{
super(new WebAppDescriptor.Builder(PACKAGE_NAME)
.contextPath(PATH).build());
}
@Test
public void testSomething()
{
Assert.assertEquals(true, true);
}
}
When I build, I get no tests found in SomeResourceTest.
Now, when I change the testcase to extend junit.framework.TestCase, the test runs just fine.
Any clue what might be causing the problem? JerseyTest is supposed to extend TestCase, so I am assuming it to be some other configuration problem.
The Jersey Test Framework is build over JUnit 4.x so, no, it doesn’t.
To run JUnit 4.x tests with Maven 1.x, you’ll have to:
Add Junit 4.X in your dependencies
Use the JUnit4TestAdapter in your test classes:
Use a JDK 5+
See http://jira.codehaus.org/browse/MPTEST-65.