use of io.elastest.etm.model.TestSuite in project elastest-torm by elastest.
the class ModelsTest method testCreateTestSuit.
@Test
public void testCreateTestSuit() {
TestSuite testSuite = new TestSuite(1L, "", 100L, 0, 0, 0, 0, 0, new ArrayList<TestCase>());
assertTrue(testSuite.getId() == 1L);
}
use of io.elastest.etm.model.TestSuite in project elastest-torm by elastest.
the class TJobExecOrchestratorService method saveFinishStatus.
public void saveFinishStatus(TJobExecution tJobExec, DockerExecution dockerExec) {
String resultMsg = "";
ResultEnum finishStatus = ResultEnum.SUCCESS;
if (tJobExec.getTestSuites() != null) {
for (TestSuite testSuite : tJobExec.getTestSuites()) {
if (testSuite.getFinalStatus() == ResultEnum.FAIL) {
// Else
// always
// success
finishStatus = testSuite.getFinalStatus();
break;
}
}
} else {
if (dockerExec.getTestContainerExitCode() != 0) {
finishStatus = ResultEnum.FAIL;
}
}
resultMsg = "Finished: " + finishStatus;
updateTJobExecResultStatus(tJobExec, finishStatus, resultMsg);
}
use of io.elastest.etm.model.TestSuite in project elastest-torm by elastest.
the class TJobExecOrchestratorService method saveTestResults.
public void saveTestResults(List<ReportTestSuite> testSuites, TJobExecution tJobExec) {
logger.info("Saving test results {} ", tJobExec.getId());
TestSuite tSuite;
TestCase tCase;
if (testSuites != null && testSuites.size() > 0) {
for (ReportTestSuite reportTestSuite : testSuites) {
tSuite = new TestSuite();
tSuite.setTimeElapsed(reportTestSuite.getTimeElapsed());
tSuite.setErrors(reportTestSuite.getNumberOfErrors());
tSuite.setFailures(reportTestSuite.getNumberOfFailures());
tSuite.setFlakes(reportTestSuite.getNumberOfFlakes());
tSuite.setSkipped(reportTestSuite.getNumberOfSkipped());
tSuite.setName(reportTestSuite.getName());
tSuite.setnumTests(reportTestSuite.getNumberOfTests());
tSuite = testSuiteRepo.save(tSuite);
for (ReportTestCase reportTestCase : reportTestSuite.getTestCases()) {
tCase = new TestCase();
// Remove parentheses
tCase.cleanNameAndSet(reportTestCase.getName());
tCase.setTime(reportTestCase.getTime());
tCase.setFailureDetail(reportTestCase.getFailureDetail());
tCase.setFailureErrorLine(reportTestCase.getFailureErrorLine());
tCase.setFailureMessage(reportTestCase.getFailureMessage());
tCase.setFailureType(reportTestCase.getFailureType());
tCase.setTestSuite(tSuite);
try {
Date startDate = this.elasticsearchService.findFirstMsgAndGetTimestamp(tJobExec.getMonitoringIndex(), this.tcStartMsgPrefix + tCase.getName() + " ", "test");
tCase.setStartDate(startDate);
Date endDate = this.elasticsearchService.findFirstMsgAndGetTimestamp(tJobExec.getMonitoringIndex(), this.tcFinishMsgPrefix + tCase.getName() + " ", "test");
tCase.setEndDate(endDate);
} catch (Exception e) {
logger.debug("Cannot save start/end date for Test Case {}", tCase.getName(), e);
}
testCaseRepo.save(tCase);
}
tSuite.settJobExec(tJobExec);
testSuiteRepo.save(tSuite);
tJobExec.getTestSuites().add(tSuite);
}
}
}
use of io.elastest.etm.model.TestSuite in project elastest-torm by elastest.
the class ModelsTest method testEqualsTestSuites.
@Test
public void testEqualsTestSuites() {
TestSuite testSuite1 = new TestSuite(1L, "", 100L, 0, 0, 0, 0, 0, new ArrayList<TestCase>());
TestSuite testSuite2 = new TestSuite(1L, "", 100L, 0, 0, 0, 0, 0, new ArrayList<TestCase>());
assertTrue(testSuite1.equals(testSuite2));
assertEquals(testSuite1.hashCode(), testSuite2.hashCode());
}
use of io.elastest.etm.model.TestSuite in project elastest-torm by elastest.
the class ModelsTest method testEqualsTestCases.
@Test
public void testEqualsTestCases() {
TestCase testCase1 = new TestCase("", 100L, "", "", "", "", new TestSuite());
TestCase testCase2 = new TestCase("", 100L, "", "", "", "", new TestSuite());
assertTrue(testCase1.equals(testCase2));
assertEquals(testCase1, testCase2);
assertEquals(testCase1.hashCode(), testCase2.hashCode());
}
Aggregations