Search in sources :

Example 1 with JUnitXmlReporter

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

the class JUnitTest method shouldRunJUnitTestsAndPrintXmlReport.

@Test
public void shouldRunJUnitTestsAndPrintXmlReport() throws Exception {
    SimpleJUnitTestListener listener = new SimpleJUnitTestListener();
    File folder = temporaryFolder.newFolder();
    TestClasses tests = TestClasses.of(JUnit4Test.class);
    JUnitXmlReporter reporter = new JUnitXmlReporter(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));
}
Also used : TestClasses(com.oracle.bedrock.testsupport.junit.options.TestClasses) AbstractJUnit4Test(com.oracle.bedrock.testsupport.junit.AbstractJUnit4Test) JUnit4Test(com.oracle.bedrock.testsupport.junit.JUnit4Test) JUnitTestRun(com.oracle.bedrock.testsupport.junit.JUnitTestRun) SimpleJUnitTestListener(com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener) File(java.io.File) JUnitXmlReporter(com.oracle.bedrock.testsupport.junit.JUnitXmlReporter) 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)1 JUnit4Test (com.oracle.bedrock.testsupport.junit.JUnit4Test)1 JUnitTestRun (com.oracle.bedrock.testsupport.junit.JUnitTestRun)1 JUnitXmlReporter (com.oracle.bedrock.testsupport.junit.JUnitXmlReporter)1 MyBadTest (com.oracle.bedrock.testsupport.junit.MyBadTest)1 MyOtherTest (com.oracle.bedrock.testsupport.junit.MyOtherTest)1 SimpleJUnitTestListener (com.oracle.bedrock.testsupport.junit.SimpleJUnitTestListener)1 TestClasses (com.oracle.bedrock.testsupport.junit.options.TestClasses)1 File (java.io.File)1 Test (org.junit.Test)1