use of com.qasymphony.ci.plugin.submitter.JunitSubmitter in project jenkin-qtest-plugin by QASymphony.
the class PushingResultAction method perform.
@SuppressWarnings("rawtypes")
@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
PrintStream logger = listener.getLogger();
JunitSubmitterRequest submitterRequest = configuration.createJunitSubmitRequest();
if (null == submitterRequest) {
LoggerUtils.formatError(logger, "Could not create JUnitSumitterRequest");
return true;
}
submitterRequest.setBuildNumber(build.getNumber() + "").setBuildPath(build.getUrl()).setListener(listener);
JunitSubmitter junitSubmitter = new JunitQtestSubmitterImpl();
String buildResult = build.getResult() + "";
if (Result.ABORTED.equals(build.getResult())) {
LoggerUtils.formatWarn(logger, "Abort build action.");
storeWhenNotSuccess(submitterRequest, junitSubmitter, build, buildResult, logger, JunitSubmitterResult.STATUS_CANCELED);
return true;
}
showInfo(logger);
if (!validateConfig(configuration)) {
LoggerUtils.formatWarn(logger, "Invalid configuration to qTest, reject submit test results.");
storeWhenNotSuccess(submitterRequest, junitSubmitter, build, buildResult, logger, JunitSubmitterResult.STATUS_FAILED);
return true;
}
if (null == checkProjectNameChanged(build, listener)) {
storeWhenNotSuccess(submitterRequest, junitSubmitter, build, buildResult, logger, JunitSubmitterResult.STATUS_CANCELED);
return true;
}
List<AutomationTestResult> automationTestResults = readTestResults(build, launcher, listener, logger);
if (automationTestResults.isEmpty()) {
LoggerUtils.formatWarn(logger, "No JUnit test result found.");
storeWhenNotSuccess(submitterRequest, junitSubmitter, build, buildResult, logger, JunitSubmitterResult.STATUS_SKIPPED);
LoggerUtils.formatHR(logger);
return true;
}
submitterRequest.setTestResults(automationTestResults);
JunitSubmitterResult result = submitTestResult(submitterRequest, build, listener, junitSubmitter, automationTestResults);
if (null == result) {
// if have no test result, we do not break build flow
return true;
}
saveConfiguration(build, result, logger);
storeResult(submitterRequest, build, buildResult, junitSubmitter, result, logger);
LoggerUtils.formatHR(logger);
return true;
}
Aggregations