use of uk.co.automatictester.lightning.ci.JUnitReporter in project lightning by automatictester.
the class JUnitReporterTest method testGetFailedTestcase.
@Test
public void testGetFailedTestcase() {
LightningTest test = mock(LightningTest.class);
when(test.getResult()).thenReturn(TestResult.FAIL);
when(test.getName()).thenReturn("some name");
when(test.getTestExecutionReport()).thenReturn("some content");
when(test.getActualResultDescription()).thenReturn("some message");
when(test.getType()).thenReturn("some type");
Element testcase = new JUnitReporter().getTestcase(test);
assertThat(testcase.getTagName(), equalTo("testcase"));
assertThat(testcase.getAttribute("time"), equalTo("0"));
assertThat(testcase.getAttribute("name"), equalTo("some name"));
assertThat(testcase.getTextContent(), equalTo("some content"));
assertThat(testcase.getElementsByTagName("failure").item(0).getAttributes().item(0).toString(), equalTo("message=\"some message\""));
assertThat(testcase.getElementsByTagName("failure").item(0).getAttributes().item(1).toString(), equalTo("type=\"some type\""));
}
use of uk.co.automatictester.lightning.ci.JUnitReporter in project lightning by automatictester.
the class JUnitReporterTest method testGetErrorTestcase.
@Test
public void testGetErrorTestcase() {
LightningTest test = mock(LightningTest.class);
when(test.getResult()).thenReturn(TestResult.ERROR);
when(test.getName()).thenReturn("some name");
when(test.getTestExecutionReport()).thenReturn("some content");
when(test.getActualResultDescription()).thenReturn("some message");
when(test.getType()).thenReturn("some type");
Element testcase = new JUnitReporter().getTestcase(test);
assertThat(testcase.getTagName(), equalTo("testcase"));
assertThat(testcase.getAttribute("time"), equalTo("0"));
assertThat(testcase.getAttribute("name"), equalTo("some name"));
assertThat(testcase.getTextContent(), equalTo("some content"));
assertThat(testcase.getElementsByTagName("error").item(0).getAttributes().item(0).toString(), equalTo("message=\"some message\""));
assertThat(testcase.getElementsByTagName("error").item(0).getAttributes().item(1).toString(), equalTo("type=\"some type\""));
}
use of uk.co.automatictester.lightning.ci.JUnitReporter in project lightning by automatictester.
the class LightningMojo method saveJunitReport.
private void saveJunitReport() {
JUnitReporter jUnitReporter = new JUnitReporter();
jUnitReporter.setTestSet(testSet);
jUnitReporter.generateJUnitReport();
}
use of uk.co.automatictester.lightning.ci.JUnitReporter in project lightning by automatictester.
the class JUnitReporterTest method testGetTestsuite.
@Test
public void testGetTestsuite() {
TestSet testSet = mock(TestSet.class);
when(testSet.getTestCount()).thenReturn(3);
when(testSet.getErrorCount()).thenReturn(1);
when(testSet.getFailCount()).thenReturn(1);
JUnitReporter jUnitReporter = new JUnitReporter();
jUnitReporter.setTestSet(testSet);
Element testsuite = jUnitReporter.getTestsuite();
assertThat(testsuite.getTagName(), equalTo("testsuite"));
assertThat(testsuite.getAttribute("tests"), equalTo("3"));
assertThat(testsuite.getAttribute("errors"), equalTo("1"));
assertThat(testsuite.getAttribute("failures"), equalTo("1"));
assertThat(testsuite.getAttribute("time"), equalTo("0"));
assertThat(testsuite.getAttribute("name"), equalTo("Lightning"));
}
use of uk.co.automatictester.lightning.ci.JUnitReporter in project lightning by automatictester.
the class JUnitReporterTest method testGetPassedTestcase.
@Test
public void testGetPassedTestcase() {
LightningTest test = mock(LightningTest.class);
when(test.getResult()).thenReturn(TestResult.PASS);
when(test.getName()).thenReturn("some name");
Element testcase = new JUnitReporter().getTestcase(test);
assertThat(testcase.getTagName(), equalTo("testcase"));
assertThat(testcase.getAttribute("time"), equalTo("0"));
assertThat(testcase.getAttribute("name"), equalTo("some name"));
}
Aggregations