@Override public void readResults(final Configuration configuration, final ResultsVisitor visitor, final Path resultsDirectory) { final Properties allureProperties = loadAllureProperties(resultsDirectory); final RandomUidContext context = configuration.requireContext(RandomUidContext.class); final Map<String, String> environment = processEnvironment(resultsDirectory); getStreamOfAllure1Results(resultsDirectory).forEach(testSuite -> testSuite.getTestCases() .forEach(testCase -> { convert(context.getValue(), resultsDirectory, visitor, testSuite, testCase, allureProperties); getEnvironmentParameters(testCase).forEach(param -> environment.put(param.getName(), param.getValue()) ); }) ); visitor.visitExtra(ENVIRONMENT_BLOCK_NAME, environment); }
final Properties properties) { final TestResult dest = new TestResult(); final String suiteName = firstNonNull(testSuite.getTitle(), testSuite.getName(), "unknown test suite"); final String testClass = firstNonNull( findLabelValue(source.getLabels(), TEST_CLASS.value()), findLabelValue(testSuite.getLabels(), TEST_CLASS.value()), testSuite.getName(), UNKNOWN ); dest.setTime(Time.create(source.getStart(), source.getStop())); dest.setParameters(parameters); dest.setDescription(getDescription(testSuite.getDescription(), source.getDescription())); dest.setDescriptionHtml(getDescriptionHtml(testSuite.getDescription(), source.getDescription())); Optional.ofNullable(source.getFailure()).ifPresent(failure -> { dest.setStatusMessage(failure.getMessage()); .thenComparing(Label::getValue, nullsFirst(naturalOrder())) ); set.addAll(convert(testSuite.getLabels(), this::convert)); set.addAll(convert(source.getLabels(), this::convert)); dest.setLabels(new ArrayList<>(set));
/** * Create an instance of {@link TestSuiteResult } * */ public TestSuiteResult createTestSuiteResult() { return new TestSuiteResult(); }
lhsName = this.getName(); String rhsName; rhsName = that.getName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "name", lhsName), LocatorUtils.property(thatLocator, "name", rhsName), lhsName, rhsName)) { return false; lhsTitle = this.getTitle(); String rhsTitle; rhsTitle = that.getTitle(); if (!strategy.equals(LocatorUtils.property(thisLocator, "title", lhsTitle), LocatorUtils.property(thatLocator, "title", rhsTitle), lhsTitle, rhsTitle)) { return false; lhsDescription = this.getDescription(); Description rhsDescription; rhsDescription = that.getDescription(); if (!strategy.equals(LocatorUtils.property(thisLocator, "description", lhsDescription), LocatorUtils.property(thatLocator, "description", rhsDescription), lhsDescription, rhsDescription)) { return false; lhsTestCases = this.getTestCases(); List<TestCaseResult> rhsTestCases; rhsTestCases = that.getTestCases(); if (!strategy.equals(LocatorUtils.property(thisLocator, "testCases", lhsTestCases), LocatorUtils.property(thatLocator, "testCases", rhsTestCases), lhsTestCases, rhsTestCases)) { return false; lhsLabels = this.getLabels(); List<Label> rhsLabels; rhsLabels = that.getLabels(); if (!strategy.equals(LocatorUtils.property(thisLocator, "labels", lhsLabels), LocatorUtils.property(thatLocator, "labels", rhsLabels), lhsLabels, rhsLabels)) { return false;
/** * Sets to testSuite start time, name, title, description and labels * * @param testSuite to change */ @Override public void process(TestSuiteResult testSuite) { testSuite.setStart(System.currentTimeMillis()); testSuite.setName(getName()); testSuite.setTitle(getTitle()); testSuite.setDescription(getDescription()); testSuite.setLabels(getLabels()); }
/** * Create fake test case, which will used for mark suite as interrupted. */ public TestCaseResult createFakeTestcaseWithWarning(TestSuiteResult testSuite) { return new TestCaseResult() .withName(testSuite.getName()) .withTitle(testSuite.getName()) .withStart(testSuite.getStart()) .withStop(System.currentTimeMillis()) .withFailure(new Failure().withMessage("Test suite was interrupted, some test cases may be lost")) .withStatus(Status.BROKEN); }
/** * Process TestSuiteFinishedEvent. Using event.getUid() to access testSuite. * Then remove this suite from storage and marshal testSuite to xml using * AllureResultsUtils.writeTestSuiteResult() * * @param event to process */ public void fire(TestSuiteFinishedEvent event) { String suiteUid = event.getUid(); TestSuiteResult testSuite = testSuiteStorage.remove(suiteUid); if (testSuite == null) { return; } event.process(testSuite); testSuite.setVersion(getVersion()); testSuite.getLabels().add(AllureModelUtils.createProgrammingLanguageLabel()); writeTestSuiteResult(testSuite); notifier.fire(event); }
public TestSuiteResult withLabels(Label... values) { if (values!= null) { for (Label value: values) { getLabels().add(value); } } return this; }
public TestSuiteResult withName(String value) { setName(value); return this; }
public TestSuiteResult withDescription(Description value) { setDescription(value); return this; }
public TestSuiteResult withLabels(List<Label> labels) { setLabels(labels); return this; }
public TestSuiteResult withStart(long value) { setStart(value); return this; }
theName = this.getName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName); theTitle = this.getTitle(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "title", theTitle), currentHashCode, theTitle); theDescription = this.getDescription(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "description", theDescription), currentHashCode, theDescription); theTestCases = this.getTestCases(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "testCases", theTestCases), currentHashCode, theTestCases); theLabels = this.getLabels(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "labels", theLabels), currentHashCode, theLabels); theStart = this.getStart(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "start", theStart), currentHashCode, theStart); theStop = this.getStop(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "stop", theStop), currentHashCode, theStop); theVersion = this.getVersion(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "version", theVersion), currentHashCode, theVersion);
@Override public void process(TestSuiteResult testSuite) { testSuite.setStart(System.currentTimeMillis()); testSuite.setName(getName()); testSuite.setTitle(getTitle()); testSuite.setDescription(getDescription()); testSuite.setLabels(getLabels()); } }
public TestSuiteResult withLabels(Collection<Label> values) { if (values!= null) { getLabels().addAll(values); } return this; }
final Properties properties) { final TestResult dest = new TestResult(); final String suiteName = firstNonNull(testSuite.getTitle(), testSuite.getName(), "unknown test suite"); final String testClass = firstNonNull( findLabelValue(source.getLabels(), TEST_CLASS.value()), findLabelValue(testSuite.getLabels(), TEST_CLASS.value()), testSuite.getName(), UNKNOWN ); dest.setTime(Time.create(source.getStart(), source.getStop())); dest.setParameters(parameters); dest.setDescription(getDescription(testSuite.getDescription(), source.getDescription())); dest.setDescriptionHtml(getDescriptionHtml(testSuite.getDescription(), source.getDescription())); Optional.ofNullable(source.getFailure()).ifPresent(failure -> { dest.setStatusMessage(failure.getMessage()); .thenComparing(Label::getValue, nullsFirst(naturalOrder())) ); set.addAll(convert(testSuite.getLabels(), this::convert)); set.addAll(convert(source.getLabels(), this::convert)); dest.setLabels(new ArrayList<>(set));
public TestSuiteResult withTestCases(TestCaseResult... values) { if (values!= null) { for (TestCaseResult value: values) { getTestCases().add(value); } } return this; }
public TestSuiteResult get(String uid) { if (!testSuiteData.containsKey(uid)) { testSuiteData.put(uid, new TestSuiteResult()); } return testSuiteData.get(uid); }
public TestSuiteResult withTestCases(Collection<TestCaseResult> values) { if (values!= null) { getTestCases().addAll(values); } return this; }
/** * Returns the value in the current copy of variable from * {@link #testSuiteData}. If the variable has no value for the uid * will be created new {@link ru.yandex.qatools.allure.model.TestSuiteResult} * * @param uid using as key for {@link #testSuiteData} to find variable * @return testSuite context for specified uid */ public TestSuiteResult get(String uid) { if (!testSuiteData.containsKey(uid)) { testSuiteData.put(uid, new TestSuiteResult()); } return testSuiteData.get(uid); }