use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest 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;
}
use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest in project jenkin-qtest-plugin by QASymphony.
the class Configuration method createJunitSubmitRequest.
public JunitSubmitterRequest createJunitSubmitRequest() {
Long containerID = this.releaseId;
String containerType = "release";
Container container = null;
if (submitToContainer) {
container = this.getContainerInfo();
if (null == container) {
return null;
}
containerID = container.getId();
containerType = container.getType();
}
JunitSubmitterRequest request = new JunitSubmitterRequest();
request.setqTestURL(this.url).setApiKey(this.appSecretKey).setConfigurationID(this.id).setSubmitToExistingContainer(this.submitToContainer).setContainerID(containerID).setContainerType(containerType).setCreateNewTestRunsEveryBuildDate(null != container ? container.getCreateNewTestSuiteEveryBuild() : null).setEnvironmentID(this.environmentId).setEnvironmentParentID(this.environmentParentId).setJenkinsProjectName(this.jenkinsProjectName).setModuleID(this.moduleId).setJenkinsServerURL(this.jenkinsServerUrl).setProjectID(this.projectId);
return request;
}
Aggregations