@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); }
public TestSuiteResult withTestCases(TestCaseResult... values) { if (values!= null) { for (TestCaseResult value: values) { getTestCases().add(value); } } return this; }
public TestSuiteResult withTestCases(Collection<TestCaseResult> values) { if (values!= null) { getTestCases().addAll(values); } return this; }
/** * Mark unfinished test cases as interrupted for each unfinished test suite, then write * test suite result * @see #createFakeTestcaseWithWarning(ru.yandex.qatools.allure.model.TestSuiteResult) * @see #markTestcaseAsInterruptedIfNotFinishedYet(ru.yandex.qatools.allure.model.TestCaseResult) */ @Override public void run() { for (Map.Entry<String, TestSuiteResult> entry : testSuites) { for (TestCaseResult testCase : entry.getValue().getTestCases()) { markTestcaseAsInterruptedIfNotFinishedYet(testCase); } entry.getValue().getTestCases().add(createFakeTestcaseWithWarning(entry.getValue())); Allure.LIFECYCLE.fire(new TestSuiteFinishedEvent(entry.getKey())); } }
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;
theTestCases = this.getTestCases(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "testCases", theTestCases), currentHashCode, theTestCases);
public void fire(TestCaseStartedEvent event) { TestCaseResult testCase = testCaseStorage.get(); event.process(testCase); synchronized (lock) { testSuiteStorage.get(event.getSuiteUid()).getTestCases().add(testCase); } }
@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); }
/** * Process TestCaseStartedEvent. New testCase will be created and added * to suite as child. * * @param event to process */ public void fire(TestCaseStartedEvent event) { //init root step in parent thread if needed stepStorage.get(); TestCaseResult testCase = testCaseStorage.get(); event.process(testCase); synchronized (TEST_SUITE_ADD_CHILD_LOCK) { testSuiteStorage.get(event.getSuiteUid()).getTestCases().add(testCase); } notifier.fire(event); }
List<TestCase> transform(List<TestSuiteResult> result) { List<TestCase> testCases = new ArrayList<TestCase>(); for (TestSuiteResult currentTestSuiteResult : result) { for (TestCaseResult currentTestCaseResult : currentTestSuiteResult.getTestCases()) { TestCase currentTestCase = new TestCase(); currentTestCase.setName(currentTestCaseResult.getName()); currentTestCase.setUniqueId(generateUniqueId(currentTestCaseResult)); currentTestCase.setStoryKeys(getStoryKeys(currentTestCaseResult)); currentTestCase.setKey(getJiraKey(currentTestCaseResult)); currentTestCase.setStatus(getStatus(currentTestCaseResult)); currentTestCase.setSeverity(getSeverity(currentTestCaseResult)); currentTestCase.setSteps(addTestSteps(currentTestCaseResult.getSteps(), 1)); testCases.add(currentTestCase); } } return testCases; }