use of uk.co.automatictester.lightning.tests.LightningTest in project lightning by automatictester.
the class JUnitReporter method generateJUnitReport.
public void generateJUnitReport() {
Node rootElement = doc.appendChild(getTestsuite());
for (LightningTest test : testSet.getTests()) {
rootElement.appendChild(getTestcase(test));
}
saveReportToDisk();
}
use of uk.co.automatictester.lightning.tests.LightningTest 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.tests.LightningTest 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.tests.LightningTest 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