use of io.irontest.models.testrun.RegularTestcaseRun in project irontest by zheng-wang.
the class RegularTestcaseRunner method run.
@Override
public TestcaseRun run() throws JsonProcessingException {
RegularTestcaseRun testcaseRun = new RegularTestcaseRun();
preProcessingForIIBTestcase();
startTestcaseRun(testcaseRun);
if (isTestcaseHasWaitForProcessingCompletionAction()) {
// milliseconds
long secondFraction = getTestcaseRunContext().getTestcaseRunStartTime().getTime() % 1000;
long millisecondsUntilNextSecond = 1000 - secondFraction;
Teststep waitStep = getTestcase().getTeststeps().get(0);
waitStep.setName("Wait " + millisecondsUntilNextSecond + " milliseconds");
waitStep.setOtherProperties(new WaitTeststepProperties(millisecondsUntilNextSecond));
}
// run test steps
for (Teststep teststep : getTestcase().getTeststeps()) {
testcaseRun.getStepRuns().add(runTeststep(teststep));
}
// test case run ends
testcaseRun.setDuration(new Date().getTime() - testcaseRun.getStartTime().getTime());
LOGGER.info("Finish running test case: " + getTestcase().getName());
for (TeststepRun teststepRun : testcaseRun.getStepRuns()) {
if (TestResult.FAILED == teststepRun.getResult()) {
testcaseRun.setResult(TestResult.FAILED);
break;
}
}
// persist test case run details into database
getTestcaseRunDAO().insert(testcaseRun);
// prepare return object for UI (reduced contents for performance)
List<TeststepRun> teststepRunsForUI = new ArrayList<>();
for (TeststepRun stepRun : testcaseRun.getStepRuns()) {
TeststepRun teststepRunForUI = new TeststepRun();
teststepRunForUI.setId(stepRun.getId());
teststepRunForUI.setResult(stepRun.getResult());
Teststep teststepForUI = new Teststep();
teststepForUI.setId(stepRun.getTeststep().getId());
teststepRunForUI.setTeststep(teststepForUI);
teststepRunsForUI.add(teststepRunForUI);
}
RegularTestcaseRun testcaseRunForUI = new RegularTestcaseRun();
testcaseRunForUI.setId(testcaseRun.getId());
testcaseRunForUI.setResult(testcaseRun.getResult());
testcaseRunForUI.setStepRuns(teststepRunsForUI);
return testcaseRunForUI;
}
use of io.irontest.models.testrun.RegularTestcaseRun in project irontest by zheng-wang.
the class TestcaseRunMapper method map.
public TestcaseRun map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
TestcaseRun testcaseRun = new RegularTestcaseRun();
testcaseRun.setId(rs.getLong("id"));
testcaseRun.setTestcaseId(rs.getLong("testcase_id"));
testcaseRun.setTestcaseName(rs.getString("testcase_name"));
testcaseRun.setTestcaseFolderPath(rs.getString("testcase_folderpath"));
testcaseRun.setStartTime(rs.getTimestamp("starttime"));
testcaseRun.setDuration(rs.getLong("duration"));
testcaseRun.setResult(TestResult.getByText(rs.getString("result")));
return testcaseRun;
}
Aggregations