private Time convert(final Long start, final Long stop) { return new Time() .setStart(start) .setStop(stop) .setDuration(nonNull(start) && nonNull(stop) ? stop - start : null); }
public CsvExportSuite(final TestResult result) { final Map<String, String> resultMap = result.toMap(); this.status = result.getStatus() != null ? result.getStatus().value() : null; this.duration = result.getTime().getDuration() != null ? result.getTime().getDuration().toString() : null; this.start = result.getTime().getStart() != null ? new Date(result.getTime().getStart()).toString() : null; this.stop = result.getTime().getStop() != null ? new Date(result.getTime().getStop()).toString() : null; this.parentSuite = resultMap.getOrDefault("parentSuite", null); this.suite = resultMap.getOrDefault("suite", null); this.subSuite = resultMap.getOrDefault("subSuite", null); this.testClass = resultMap.getOrDefault("testClass", null); this.testMethod = resultMap.getOrDefault("testMethod", null); this.name = result.getName(); this.description = result.getDescription(); }
public static Time create(final Long duration) { return new Time().setDuration(duration); }
@Issue("587") @Issue("572") @Test public void shouldSortByStartTimeAsc() throws Exception { final TestResult first = new TestResult() .setName("first") .setTime(new Time().setStart(10L)); final TestResult second = new TestResult() .setName("second") .setTime(new Time().setStart(100L)); final TestResult third = new TestResult() .setName("third") .setTime(new Time().setStart(50L)); final TestResult timeless = new TestResult() .setName("timeless"); final LaunchResults results = new DefaultLaunchResults( new HashSet<>(Arrays.asList(first, second, third, timeless)), Collections.emptyMap(), Collections.emptyMap() ); final PackagesPlugin packagesPlugin = new PackagesPlugin(); final Tree<TestResult> tree = packagesPlugin.getData(singletonList(results)); assertThat(tree.getChildren()) .extracting("name") .containsExactly("timeless", "first", "third", "second"); } }
dest.setTime(Time.create(source.getStart(), source.getStop())); dest.setParameters(parameters); dest.setDescription(getDescription(testSuite.getDescription(), source.getDescription()));
@Issue("587") @Issue("572") @Test public void shouldSortByStartTimeAsc() throws Exception { final TestResult first = new TestResult() .setName("first") .setTime(new Time().setStart(10L)); final TestResult second = new TestResult() .setName("second") .setTime(new Time().setStart(12L)); final TestResult timeless = new TestResult() .setName("timeless"); final Tree<TestResult> tree = SuitesPlugin.getData( createSingleLaunchResults(second, first, timeless) ); assertThat(tree.getChildren()) .extracting(TreeNode::getName) .containsExactly("timeless", "first", "second"); }
public static Time create(final Long duration) { return new Time().setDuration(duration); }
private void convert(final Supplier<String> uidGenerator, final Path resultsDirectory, final ResultsVisitor visitor, final List<TestResultContainer> groups, final TestResult result) { final io.qameta.allure.entity.TestResult dest = new io.qameta.allure.entity.TestResult(); dest.setUid(uidGenerator.get()); dest.setHistoryId(result.getHistoryId()); dest.setFullName(result.getFullName()); dest.setName(firstNonNull(result.getName(), result.getFullName(), "Unknown test")); dest.setTime(Time.create(result.getStart(), result.getStop())); dest.setDescription(result.getDescription()); dest.setDescriptionHtml(result.getDescriptionHtml()); dest.setStatus(convert(result.getStatus())); Optional.ofNullable(result.getStatusDetails()).ifPresent(details -> { dest.setStatusMessage(details.getMessage()); dest.setStatusTrace(details.getTrace()); }); dest.setLinks(convert(result.getLinks(), this::convert)); dest.setLabels(convert(result.getLabels(), this::convert)); dest.setParameters(getParameters(result)); dest.addLabelIfNotExists(RESULT_FORMAT, ALLURE2_RESULTS_FORMAT); if (hasTestStage(result)) { dest.setTestStage(getTestStage(resultsDirectory, visitor, result)); } final List<TestResultContainer> parents = findAllParents(groups, result.getUuid(), new HashSet<>()); dest.getBeforeStages().addAll(getStages(parents, fixture -> getBefore(resultsDirectory, visitor, fixture))); dest.getAfterStages().addAll(getStages(parents, fixture -> getAfter(resultsDirectory, visitor, fixture))); visitor.visitTestResult(dest); }
public static Time create(final Long start, final Long stop) { return new Time() .setStart(start) .setStop(stop) .setDuration(isNull(start) || isNull(stop) ? null : stop - start); }
@Issue("587") @Issue("572") @Test public void shouldSortByStartTimeAsc() throws Exception { final Category category = new Category().setName("some"); final TestResult first = new TestResult() .setName("first") .setStatus(Status.FAILED) .setTime(new Time().setStart(10L)); first.addExtraBlock(CATEGORIES, singletonList(category)); final TestResult second = new TestResult() .setName("second") .setStatus(Status.FAILED) .setTime(new Time().setStart(12L)); second.addExtraBlock(CATEGORIES, singletonList(category)); final TestResult timeless = new TestResult() .setName("timeless") .setStatus(Status.FAILED); timeless.addExtraBlock(CATEGORIES, singletonList(category)); final Tree<TestResult> tree = CategoriesPlugin.getData( createSingleLaunchResults(second, first, timeless) ); assertThat(tree.getChildren()) .flatExtracting("children") .flatExtracting("children") .extracting("name") .containsExactly("timeless", "first", "second"); }
public void update(final Time time) { if (Objects.isNull(time)) { return; } update(firstNonNull(getStart(), MAX_VALUE), time.getStart(), Math::min, this::setStart); update(firstNonNull(getStop(), 0L), time.getStop(), Math::max, this::setStop); update(getStop(), getStart(), (a, b) -> a - b, this::setDuration); update(firstNonNull(getMinDuration(), MAX_VALUE), time.getDuration(), Math::min, this::setMinDuration); update(firstNonNull(getMaxDuration(), 0L), time.getDuration(), Math::max, this::setMaxDuration); update(firstNonNull(getSumDuration(), 0L), time.getDuration(), (a, b) -> a + b, this::setSumDuration); }
dest.setTime(Time.create(source.getStart(), source.getStop())); dest.setParameters(parameters); dest.setDescription(getDescription(testSuite.getDescription(), source.getDescription()));
private Step convert(final Path source, final ResultsVisitor visitor, final ru.yandex.qatools.allure.model.Step s, final Status testStatus, final String message, final String trace) { final Status status = convert(s.getStatus()); final Step current = new Step() .setName(s.getTitle() == null ? s.getName() : s.getTitle()) .setTime(new Time() .setStart(s.getStart()) .setStop(s.getStop()) .setDuration(s.getStop() - s.getStart())) .setStatus(status) .setSteps(convert(s.getSteps(), step -> convert(source, visitor, step, testStatus, message, trace))) .setAttachments(convert(s.getAttachments(), attach -> convert(source, visitor, attach))); //Copy test status details to each step set the same status if (Objects.equals(status, testStatus)) { current.setStatusMessage(message); current.setStatusMessage(trace); } return current; }
public CsvExportSuite(final TestResult result) { final Map<String, String> resultMap = result.toMap(); this.status = result.getStatus() != null ? result.getStatus().value() : null; this.duration = result.getTime().getDuration() != null ? result.getTime().getDuration().toString() : null; this.start = result.getTime().getStart() != null ? new Date(result.getTime().getStart()).toString() : null; this.stop = result.getTime().getStop() != null ? new Date(result.getTime().getStop()).toString() : null; this.parentSuite = resultMap.getOrDefault("parentSuite", null); this.suite = resultMap.getOrDefault("suite", null); this.subSuite = resultMap.getOrDefault("subSuite", null); this.testClass = resultMap.getOrDefault("testClass", null); this.testMethod = resultMap.getOrDefault("testMethod", null); this.name = result.getName(); this.description = result.getDescription(); }
private void convert(final Supplier<String> uidGenerator, final Path resultsDirectory, final ResultsVisitor visitor, final List<TestResultContainer> groups, final TestResult result) { final io.qameta.allure.entity.TestResult dest = new io.qameta.allure.entity.TestResult(); dest.setUid(uidGenerator.get()); dest.setHistoryId(result.getHistoryId()); dest.setFullName(result.getFullName()); dest.setName(firstNonNull(result.getName(), result.getFullName(), "Unknown test")); dest.setTime(Time.create(result.getStart(), result.getStop())); dest.setDescription(result.getDescription()); dest.setDescriptionHtml(result.getDescriptionHtml()); dest.setStatus(convert(result.getStatus())); Optional.ofNullable(result.getStatusDetails()).ifPresent(details -> { dest.setStatusMessage(details.getMessage()); dest.setStatusTrace(details.getTrace()); }); dest.setLinks(convert(result.getLinks(), this::convert)); dest.setLabels(convert(result.getLabels(), this::convert)); dest.setParameters(getParameters(result)); dest.addLabelIfNotExists(RESULT_FORMAT, ALLURE2_RESULTS_FORMAT); if (hasTestStage(result)) { dest.setTestStage(getTestStage(resultsDirectory, visitor, result)); } final List<TestResultContainer> parents = findAllParents(groups, result.getUuid(), new HashSet<>()); dest.getBeforeStages().addAll(getStages(parents, fixture -> getBefore(resultsDirectory, visitor, fixture))); dest.getAfterStages().addAll(getStages(parents, fixture -> getAfter(resultsDirectory, visitor, fixture))); visitor.visitTestResult(dest); }
private Time convert(final Long start, final Long stop) { return new Time() .setStart(start) .setStop(stop) .setDuration(nonNull(start) && nonNull(stop) ? stop - start : null); }
public void update(final Time time) { if (Objects.isNull(time)) { return; } update(firstNonNull(getStart(), MAX_VALUE), time.getStart(), Math::min, this::setStart); update(firstNonNull(getStop(), 0L), time.getStop(), Math::max, this::setStop); update(getStop(), getStart(), (a, b) -> a - b, this::setDuration); update(firstNonNull(getMinDuration(), MAX_VALUE), time.getDuration(), Math::min, this::setMinDuration); update(firstNonNull(getMaxDuration(), 0L), time.getDuration(), Math::max, this::setMaxDuration); update(firstNonNull(getSumDuration(), 0L), time.getDuration(), (a, b) -> a + b, this::setSumDuration); }
public static Time create(final Long start, final Long stop) { return new Time() .setStart(start) .setStop(stop) .setDuration(isNull(start) || isNull(stop) ? null : stop - start); }
private Step convert(final Path source, final ResultsVisitor visitor, final ru.yandex.qatools.allure.model.Step s, final Status testStatus, final String message, final String trace) { final Status status = convert(s.getStatus()); final Step current = new Step() .setName(s.getTitle() == null ? s.getName() : s.getTitle()) .setTime(new Time() .setStart(s.getStart()) .setStop(s.getStop()) .setDuration(s.getStop() - s.getStart())) .setStatus(status) .setSteps(convert(s.getSteps(), step -> convert(source, visitor, step, testStatus, message, trace))) .setAttachments(convert(s.getAttachments(), attach -> convert(source, visitor, attach))); //Copy test status details to each step set the same status if (Objects.equals(status, testStatus)) { current.setStatusMessage(message); current.setStatusMessage(trace); } return current; }