private void addIdeaLink(final TestResult testResult) { final String fileExtension = "java"; final String port = getProperty(ALLURE_IDEA_PORT).orElse("63342"); final Optional<String> testClassName = testResult.getLabels().stream() .filter(label -> "testClass".equals(label.getName())) .map(Label::getValue) .findFirst(); testClassName.ifPresent(name -> { final String path = name.replace(".", "/"); final String url = String.format("http://localhost:%s/api/file?file=%s.%s", port, path, fileExtension); testResult.getLinks().add(new Link().setName(IDEA_LINK_NAME).setType(IDEA_LINK_TYPE).setUrl(url)); }); }
private Link getLink(final LabelName labelName, final String value, final String url) { return new Link().setName(value).setType(labelName.value()).setUrl(url); }
private Link convert(final io.qameta.allure.model.Link link) { return new Link() .setName(link.getName()) .setType(link.getType()) .setUrl(link.getUrl()); }
@Test public void shouldExportTestRunToXray() { final LaunchResults launchResults = mock(LaunchResults.class); final TestResult testResult = createTestResult(Status.FAILED) .setLinks(Collections.singletonList(new Link().setName(TESTRUN_KEY).setType("tms"))); final Set<TestResult> results = new HashSet<>(Collections.singletonList(testResult)); when(launchResults.getAllResults()).thenReturn(results); final ExecutorInfo executorInfo = new ExecutorInfo() .setBuildName(RandomStringUtils.random(10)) .setReportUrl(RandomStringUtils.random(10)); when(launchResults.getExtra("executor")).thenReturn(Optional.of(executorInfo)); final JiraService service = mock(JiraService.class); when(service.getTestRunsForTestExecution(EXECUTION_ISSUES)).thenReturn( Collections.singletonList(new XrayTestRun().setId(TESTRUN_ID).setKey(TESTRUN_KEY).setStatus("TODO")) ); final XrayTestRunExportPlugin xrayTestRunExportPlugin = new XrayTestRunExportPlugin(); xrayTestRunExportPlugin.setJiraService(service); xrayTestRunExportPlugin.aggregate( mock(Configuration.class), Collections.singletonList(launchResults), Paths.get("/") ); final String reportLink = String.format("[%s|%s]", executorInfo.getBuildName(), executorInfo.getReportUrl()); verify(service, times(1)).createIssueComment( argThat(issue -> issue.equals(EXECUTION_ISSUES)), argThat(comment -> comment.getBody().contains(reportLink) )); verify(service, times(1)).updateTestRunStatus(TESTRUN_ID, "FAIL"); }
final LaunchResults launchResults = mock(LaunchResults.class); final List<Link> links = ISSUES.stream() .map(issue -> new Link().setName(issue).setType("issue")) .collect(Collectors.toList());
); dest.findOneLabel("testId").ifPresent(testId -> dest.getLinks().add(new Link().setName(testId).setType("tms") .setUrl(getTestCaseIdUrl(testId, properties))) );
private void addIdeaLink(final TestResult testResult) { final String fileExtension = "java"; final String port = getProperty(ALLURE_IDEA_PORT).orElse("63342"); final Optional<String> testClassName = testResult.getLabels().stream() .filter(label -> "testClass".equals(label.getName())) .map(Label::getValue) .findFirst(); testClassName.ifPresent(name -> { final String path = name.replace(".", "/"); final String url = String.format("http://localhost:%s/api/file?file=%s.%s", port, path, fileExtension); testResult.getLinks().add(new Link().setName(IDEA_LINK_NAME).setType(IDEA_LINK_TYPE).setUrl(url)); }); }
private Link getLink(final LabelName labelName, final String value, final String url) { return new Link().setName(value).setType(labelName.value()).setUrl(url); }
private Link convert(final io.qameta.allure.model.Link link) { return new Link() .setName(link.getName()) .setType(link.getType()) .setUrl(link.getUrl()); }
); dest.findOneLabel("testId").ifPresent(testId -> dest.getLinks().add(new Link().setName(testId).setType("tms") .setUrl(getTestCaseIdUrl(testId, properties))) );