Search in sources :

Example 1 with TestSuite

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);
}
Also used : TestSuite(io.elastest.etm.model.TestSuite) TestCase(io.elastest.etm.model.TestCase) Test(org.junit.jupiter.api.Test)

Example 2 with TestSuite

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);
}
Also used : TestSuite(io.elastest.etm.model.TestSuite) ReportTestSuite(org.apache.maven.plugins.surefire.report.ReportTestSuite) ResultEnum(io.elastest.etm.model.TJobExecution.ResultEnum)

Example 3 with TestSuite

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);
        }
    }
}
Also used : ReportTestSuite(org.apache.maven.plugins.surefire.report.ReportTestSuite) TestSuite(io.elastest.etm.model.TestSuite) ReportTestSuite(org.apache.maven.plugins.surefire.report.ReportTestSuite) TestCase(io.elastest.etm.model.TestCase) ReportTestCase(org.apache.maven.plugins.surefire.report.ReportTestCase) ReportTestCase(org.apache.maven.plugins.surefire.report.ReportTestCase) Date(java.util.Date) IOException(java.io.IOException)

Example 4 with TestSuite

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());
}
Also used : TestSuite(io.elastest.etm.model.TestSuite) TestCase(io.elastest.etm.model.TestCase) Test(org.junit.jupiter.api.Test)

Example 5 with TestSuite

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());
}
Also used : TestSuite(io.elastest.etm.model.TestSuite) TestCase(io.elastest.etm.model.TestCase) Test(org.junit.jupiter.api.Test)

Aggregations

TestSuite (io.elastest.etm.model.TestSuite)5 TestCase (io.elastest.etm.model.TestCase)4 Test (org.junit.jupiter.api.Test)3 ReportTestSuite (org.apache.maven.plugins.surefire.report.ReportTestSuite)2 ResultEnum (io.elastest.etm.model.TJobExecution.ResultEnum)1 IOException (java.io.IOException)1 Date (java.util.Date)1 ReportTestCase (org.apache.maven.plugins.surefire.report.ReportTestCase)1