use of uk.co.automatictester.lightning.TestSet 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.TestSet in project lightning by automatictester.
the class TestSetReporterTest method testPrintTestSetExecutionSummaryReportForPass.
@Test
public void testPrintTestSetExecutionSummaryReportForPass() {
String expectedResult = String.format("============= EXECUTION SUMMARY =============%n" + "Tests executed: 15%n" + "Tests passed: 15%n" + "Tests failed: 0%n" + "Tests errors: 0%n" + "Test set status: Pass");
TestSet testSet = mock(TestSet.class);
when(testSet.getTestCount()).thenReturn(15);
when(testSet.getPassCount()).thenReturn(15);
when(testSet.getFailCount()).thenReturn(0);
when(testSet.getErrorCount()).thenReturn(0);
String output = new TestSetReporter(testSet).getTestSetExecutionSummaryReport();
assertThat(output, containsString(expectedResult));
}
use of uk.co.automatictester.lightning.TestSet in project lightning by automatictester.
the class TestSetReporterTest method testPrintTestSetExecutionSummaryReportForFail.
@Test
public void testPrintTestSetExecutionSummaryReportForFail() {
String expectedResult = String.format("============= EXECUTION SUMMARY =============%n" + "Tests executed: 15%n" + "Tests passed: 14%n" + "Tests failed: 1%n" + "Tests errors: 0%n" + "Test set status: FAIL");
TestSet testSet = mock(TestSet.class);
when(testSet.getTestCount()).thenReturn(15);
when(testSet.getPassCount()).thenReturn(14);
when(testSet.getFailCount()).thenReturn(1);
when(testSet.getErrorCount()).thenReturn(0);
String output = new TestSetReporter(testSet).getTestSetExecutionSummaryReport();
assertThat(output, containsString(expectedResult));
}
use of uk.co.automatictester.lightning.TestSet in project lightning by automatictester.
the class TestSetReporterTest method testPrintTestSetExecutionSummaryReportForIgnore.
@Test
public void testPrintTestSetExecutionSummaryReportForIgnore() {
String expectedResult = String.format("============= EXECUTION SUMMARY =============%n" + "Tests executed: 15%n" + "Tests passed: 14%n" + "Tests failed: 0%n" + "Tests errors: 1%n" + "Test set status: FAIL");
TestSet testSet = mock(TestSet.class);
when(testSet.getTestCount()).thenReturn(15);
when(testSet.getPassCount()).thenReturn(14);
when(testSet.getFailCount()).thenReturn(0);
when(testSet.getErrorCount()).thenReturn(1);
String output = new TestSetReporter(testSet).getTestSetExecutionSummaryReport();
assertThat(output, containsString(expectedResult));
}
use of uk.co.automatictester.lightning.TestSet in project lightning by automatictester.
the class CliTestRunner method runTests.
private static void runTests() {
long testSetExecStart = System.currentTimeMillis();
File xmlFile = params.verify.getXmlFile();
File jmeterCsvFile = params.verify.getJmeterCsvFile();
File perfmonCsvFile = params.verify.getPerfmonCsvFile();
LightningXMLFileReader xmlFileReader = new LightningXMLFileReader();
xmlFileReader.readTests(xmlFile);
List<ClientSideTest> clientSideTests = xmlFileReader.getClientSideTests();
List<ServerSideTest> serverSideTests = xmlFileReader.getServerSideTests();
testSet = new TestSet(clientSideTests, serverSideTests);
jmeterTransactions = new JMeterCSVFileReader().getTransactions(jmeterCsvFile);
if (params.verify.isPerfmonCsvFileProvided()) {
perfMonDataEntries = new PerfMonDataReader().getDataEntires(perfmonCsvFile);
testSet.executeServerSideTests(perfMonDataEntries);
}
testSet.executeClientSideTests(jmeterTransactions);
testSet.printTestExecutionReport();
new TestSetReporter(testSet).printTestSetExecutionSummaryReport();
long testSetExecEnd = System.currentTimeMillis();
long testExecTime = testSetExecEnd - testSetExecStart;
logger.info("Total execution time: {}ms", testExecTime);
if (testSet.getFailCount() + testSet.getErrorCount() != 0) {
exitCode = 1;
}
}
Aggregations