use of com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener 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));
}
use of com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener in project oracle-bedrock by coherence-community.
the class JUnitTest method shouldRunJUnitTestsWithMethodIncludesAndExcludes.
@Test
public void shouldRunJUnitTestsWithMethodIncludesAndExcludes() throws Exception {
SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
try (JUnitTestRun jUnit = platform.launch(JUnitTestRun.class, listener.asOption(), TestClasses.of(JUnit4Test.class, MyOtherTest.class).include("(.)*JUnit4(.)*").exclude("#shouldFail"))) {
jUnit.waitFor();
assertThat(listener.awaitCompletion(2, TimeUnit.MINUTES), is(true));
}
assertThat(listener.hasTestFailures(), is(false));
assertThat(listener.getTestCount(), is(2));
assertThat(listener.getErrorCount(), is(0));
assertThat(listener.getFailureCount(), is(0));
assertThat(listener.getSkipCount(), is(2));
}
use of com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener in project oracle-bedrock by coherence-community.
the class JUnitTest method shouldRunJUnitTestsWithMethodExcludes.
@Test
public void shouldRunJUnitTestsWithMethodExcludes() throws Exception {
SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
try (JUnitTestRun jUnit = platform.launch(JUnitTestRun.class, listener.asOption(), TestClasses.of(JUnit4Test.class).exclude("#shouldFail"))) {
jUnit.waitFor();
assertThat(listener.awaitCompletion(2, TimeUnit.MINUTES), is(true));
}
assertThat(listener.hasTestFailures(), is(false));
assertThat(listener.getTestCount(), is(2));
assertThat(listener.getErrorCount(), is(0));
assertThat(listener.getFailureCount(), is(0));
assertThat(listener.getSkipCount(), is(2));
}
use of com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener in project oracle-bedrock by coherence-community.
the class JUnitTest method shouldRunJUnitTestsWithClassExcludes.
@Test
public void shouldRunJUnitTestsWithClassExcludes() throws Exception {
SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
try (JUnitTestRun jUnit = platform.launch(JUnitTestRun.class, listener.asOption(), TestClasses.of(JUnit4Test.class, MyOtherTest.class).exclude("(.)*MyOtherTest(.)*"))) {
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));
}
use of com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener in project oracle-bedrock by coherence-community.
the class JUnitTest method shouldRunJUnitTestsAndPrintTextReport.
@Test
public void shouldRunJUnitTestsAndPrintTextReport() throws Exception {
SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
File folder = temporaryFolder.newFolder();
TestClasses tests = TestClasses.of(JUnit4Test.class);
JUnitTextReporter reporter = new JUnitTextReporter(folder);
try (JUnitTestRun jUnit = platform.launch(JUnitTestRun.class, tests, reporter.asOption(), listener.asOption())) {
jUnit.waitFor();
assertThat(listener.awaitCompletion(2, TimeUnit.MINUTES), is(true));
}
dumpReports(folder);
assertThat(new File(folder, reporter.getReportFileName(JUnit4Test.class)).exists(), is(true));
}
Aggregations