Search in sources :

Example 1 with JUnit4Test

use of com.oracle.bedrock.testsupport.junit.JUnit4Test in project oracle-bedrock by coherence-community.

the class JUnitTest method shouldRunJUnitTestsWithClassIncludes.

@Test
public void shouldRunJUnitTestsWithClassIncludes() throws Exception {
    SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
    try (JUnitTestRun jUnit = platform.launch(JUnitTestRun.class, listener.asOption(), TestClasses.of(JUnit4Test.class, MyOtherTest.class).include("(.)*JUnit4Test"))) {
        jUnit.waitFor();
        assertThat(listener.awaitCompletion(2, TimeUnit.MINUTES), is(true));
    }
    assertThat(listener.hasTestFailures(), is(true));
    assertThat(listener.getTestCount(), is(3));
    assertThat(listener.getErrorCount(), is(0));
    assertThat(listener.getFailureCount(), is(1));
    assertThat(listener.getSkipCount(), is(2));
}
Also used : JUnitTestRun(com.oracle.bedrock.testsupport.junit.JUnitTestRun) SimpleJUnitTestListener(com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener) AbstractJUnit4Test(com.oracle.bedrock.testsupport.junit.AbstractJUnit4Test) MyBadTest(com.oracle.bedrock.testsupport.junit.MyBadTest) JUnit4Test(com.oracle.bedrock.testsupport.junit.JUnit4Test) MyOtherTest(com.oracle.bedrock.testsupport.junit.MyOtherTest) Test(org.junit.Test)

Example 2 with JUnit4Test

use of com.oracle.bedrock.testsupport.junit.JUnit4Test in project oracle-bedrock by coherence-community.

the class JUnitTest method shouldRunJUnitTestsFromClassPathWithMethodIncludes.

@Test
public void shouldRunJUnitTestsFromClassPathWithMethodIncludes() throws Exception {
    SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
    try (JUnitTestRun jUnit = platform.launch(JUnitTestRun.class, listener.asOption(), TestClasses.from(ClassPath.ofClass(AbstractJUnit4Test.class)).include("(.)*JUnit4Test#(.)*Pass(.*)"))) {
        jUnit.waitFor();
        assertThat(listener.awaitCompletion(2, TimeUnit.MINUTES), is(true));
    }
    assertThat(listener.hasTestFailures(), is(false));
    assertThat(listener.getTestCount(), is(1));
    assertThat(listener.getErrorCount(), is(0));
    assertThat(listener.getFailureCount(), is(0));
    assertThat(listener.getSkipCount(), is(0));
}
Also used : AbstractJUnit4Test(com.oracle.bedrock.testsupport.junit.AbstractJUnit4Test) JUnitTestRun(com.oracle.bedrock.testsupport.junit.JUnitTestRun) SimpleJUnitTestListener(com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener) AbstractJUnit4Test(com.oracle.bedrock.testsupport.junit.AbstractJUnit4Test) MyBadTest(com.oracle.bedrock.testsupport.junit.MyBadTest) JUnit4Test(com.oracle.bedrock.testsupport.junit.JUnit4Test) MyOtherTest(com.oracle.bedrock.testsupport.junit.MyOtherTest) Test(org.junit.Test)

Aggregations

AbstractJUnit4Test (com.oracle.bedrock.testsupport.junit.AbstractJUnit4Test)2 JUnit4Test (com.oracle.bedrock.testsupport.junit.JUnit4Test)2 JUnitTestRun (com.oracle.bedrock.testsupport.junit.JUnitTestRun)2 MyBadTest (com.oracle.bedrock.testsupport.junit.MyBadTest)2 MyOtherTest (com.oracle.bedrock.testsupport.junit.MyOtherTest)2 SimpleJUnitTestListener (com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener)2 Test (org.junit.Test)2