use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest in project jenkin-qtest-plugin by QASymphony.
the class TestResultFromxUnit method testParser.
@LocalData
@Test
public void testParser() throws InterruptedException, ExecutionException, TimeoutException, IOException {
project = j.createFreeStyleProject("xunit-project");
Configuration configuration = Configuration.newInstance();
configuration.setReadFromJenkins(true);
configuration.setProjectName("TestResultFromxUnitProject");
// configuration.setAppSecretKey("34428172-cdba-4c97-aefb-b2ee5ae5db99");
configuration.setAppSecretKey("5d65f50e-b368-47a1-9bff-e0a710011a3f");
configuration.setReleaseId(1L);
configuration.setId(1L);
configuration.setProjectId(1L);
configuration.setUrl("https://localhost:7443");
configuration.setJenkinsProjectName("TestResultFromxUnitProject");
configuration.setJenkinsServerUrl("http://localhost:8080/jenkins");
TestResultFromxUnitProject testResultFromxUnitProject = new TestResultFromxUnitProject(configuration);
configuration.setResultPattern("*.xml");
project.getBuildersList().add(testResultFromxUnitProject);
FreeStyleBuild build = project.scheduleBuild2(0).get(100, TimeUnit.MINUTES);
assertNotNull("", testResultFromxUnitProject.getAutomationTestResultList());
assertNotNull("Build is: ", build);
String buildNumber = "1";
String buildPath = "/jobs/TestResultFromxUnitProject/" + buildNumber;
JunitSubmitterRequest submitterRequest = configuration.createJunitSubmitRequest();
try {
AutomationTestService.push(buildNumber, buildPath, testResultFromxUnitProject.getAutomationTestResultList(), submitterRequest, configuration.getAppSecretKey());
} catch (SubmittedException e) {
e.printStackTrace();
}
}
use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest in project jenkin-qtest-plugin by QASymphony.
the class PipelineConfiguration method createJunitSubmitRequest.
public JunitSubmitterRequest createJunitSubmitRequest() {
JunitSubmitterRequest request = new JunitSubmitterRequest();
request.setqTestURL(this.qtestURL).setApiKey(this.apiKey).setConfigurationID(null).setSubmitToExistingContainer(this.submitToExistingContainer).setContainerID(containerID).setContainerType(containerType).setCreateNewTestRunsEveryBuildDate(submitToExistingContainer ? createNewTestRunsEveryBuildDate : null).setEnvironmentID(this.environmentID).setProjectID(this.projectID);
return request;
}
use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest in project jenkin-qtest-plugin by QASymphony.
the class JunitTestResultParserTests method testSubmitLogWithAttachment.
@Test
public void testSubmitLogWithAttachment() throws InterruptedException, ExecutionException, TimeoutException, IOException, SubmittedException {
String buildNumber = "1";
String buildPath = "/jobs/TestPerformance/" + buildNumber;
String projectName = "TestPerformance";
String apiKey = "3c76feb4-b91f-4a53-8643-bd1ce2f01a3e";
Long releaseId = 1L;
Long ciId = 3L;
Long qTestProjectId = 1L;
Configuration configuration = new Configuration(ciId, "https://localhost:7443", apiKey, qTestProjectId, projectName, releaseId, "releaseName", 0L, "environment", 0L, 0L, false, "", false, "{}", false, 0);
List<AutomationTestResult> results = new ArrayList<>();
long start = System.currentTimeMillis();
int total = 1000;
for (int i = 0; i < total; i++) {
AutomationTestResult automationTestResult = new AutomationTestResult();
automationTestResult.setName("Test Performance " + i);
automationTestResult.setAutomationContent(automationTestResult.getName());
automationTestResult.setStatus(CaseResult.Status.PASSED.toString());
automationTestResult.setExecutedStartDate(new Date());
automationTestResult.setExecutedEndDate(new Date());
results.add(automationTestResult);
List<AutomationTestStepLog> testLogs = new ArrayList<>();
List<AutomationAttachment> automationAttachments = new ArrayList<>();
for (int j = 0; j < 100; j++) {
AutomationTestStepLog automationTestStepLog = new AutomationTestStepLog();
automationTestStepLog.setOrder(j);
automationTestStepLog.setStatus(CaseResult.Status.FAILED.toString());
automationTestStepLog.setDescription("Test Description of " + j + " in class: " + i);
automationTestStepLog.setExpectedResult(CaseResult.Status.FAILED.toString());
testLogs.add(automationTestStepLog);
AutomationAttachment automationAttachment = new AutomationAttachment();
automationAttachment.setName(automationTestStepLog.getDescription() + ".txt");
automationAttachment.setContentType("text/plain");
StringBuilder sb = new StringBuilder();
for (int k = 0; k < 10; k++) sb.append("Test attachment data");
automationAttachment.setData(sb.toString());
automationAttachments.add(automationAttachment);
}
automationTestResult.setTestLogs(testLogs);
automationTestResult.setAttachments(automationAttachments);
}
JunitSubmitterRequest submitterRequest = configuration.createJunitSubmitRequest();
AutomationTestService.push(buildNumber, buildPath, results, submitterRequest, configuration.getAppSecretKey());
System.out.println("End submit in: " + LoggerUtils.elapsedTime(start));
}
use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest in project jenkin-qtest-plugin by QASymphony.
the class JunitTestResultParserTests method testSubmitLog.
@Test
public void testSubmitLog() throws InterruptedException, ExecutionException, TimeoutException, IOException, SubmittedException {
String buildNumber = "1";
String buildPath = "/jobs/TestPerformance/" + buildNumber;
String projectName = "TestPerformance";
String apiKey = "3c76feb4-b91f-4a53-8643-bd1ce2f01a3e";
Long releaseId = 1L;
Long ciId = 3L;
Long qTestProjectId = 1L;
Configuration configuration = new Configuration(ciId, "https://localhost:7443", apiKey, qTestProjectId, projectName, releaseId, "releaseName", 0L, "environment", 0L, 0L, false, "", false, "{}", false, 0);
List<AutomationTestResult> results = new ArrayList<>();
int total = 1000;
for (int i = 0; i < total; i++) {
AutomationTestResult automationTestResult = new AutomationTestResult();
automationTestResult.setName("Test Performance " + i);
automationTestResult.setAutomationContent(automationTestResult.getName());
automationTestResult.setStatus(CaseResult.Status.PASSED.toString());
automationTestResult.setExecutedStartDate(new Date());
automationTestResult.setExecutedEndDate(new Date());
results.add(automationTestResult);
List<AutomationTestStepLog> testLogs = new ArrayList<>();
for (int j = 0; j < 10; j++) {
AutomationTestStepLog automationTestStepLog = new AutomationTestStepLog();
automationTestStepLog.setOrder(j);
automationTestStepLog.setStatus(CaseResult.Status.PASSED.toString());
automationTestStepLog.setDescription("Test Description of " + j + " in class: " + i);
automationTestStepLog.setExpectedResult(CaseResult.Status.PASSED.toString());
testLogs.add(automationTestStepLog);
}
automationTestResult.setTestLogs(testLogs);
}
JunitSubmitterRequest submitterRequest = configuration.createJunitSubmitRequest();
AutomationTestService.push(buildNumber, buildPath, results, submitterRequest, configuration.getAppSecretKey());
}
use of com.qasymphony.ci.plugin.submitter.JunitSubmitterRequest in project jenkin-qtest-plugin by QASymphony.
the class JunitTestResultParserTests method testSubmitWithAutomationXMLContent.
@LocalData
@Test
public void testSubmitWithAutomationXMLContent() throws InterruptedException, ExecutionException, TimeoutException, IOException, SubmittedException {
project = j.createFreeStyleProject("ant-project");
automationTestResultList = null;
project.getBuildersList().add(new JUnitParserTestAntProject());
FreeStyleBuild build = project.scheduleBuild2(0).get(100, TimeUnit.MINUTES);
assertNotNull("Build is: ", build);
String buildNumber = "1";
String buildPath = "/jobs/AntProjectWithXMLContent/" + buildNumber;
String projectName = "AntProjectWithXMLContent";
String apiKey = "9d3971a6-f6d7-4e0b-996c-e2ade023b4e8";
Long releaseId = 1L;
Long ciId = 1L;
Long qTestProjectId = 3L;
Configuration configuration = new Configuration(ciId, "https://localhost:7443", apiKey, qTestProjectId, projectName, releaseId, "releaseName", 0L, "environment", 0L, 0L, false, "", false, "{}", false, 0);
JunitSubmitterRequest submitterRequest = configuration.createJunitSubmitRequest();
submitterRequest.setBuildNumber("1").setBuildPath(buildPath);
AutomationTestService.push(buildNumber, buildPath, automationTestResultList, submitterRequest, configuration.getAppSecretKey());
}
Aggregations