private void updateResultsForAnyExternalFailures( TestOutcome testOutcome, TestOutcome scenarioOutcome) { if (rowResultsAreInconsistantWithOverallResult(testOutcome)) { testOutcome.getDataTable().getRows().get(0).updateResult(testOutcome.getResult()); scenarioOutcome.addFailingExternalStep( new AssertionError(testOutcome.getTestFailureMessage())); } }
private List<TestOutcome> aggregatedScenarioOutcomes(List<TestOutcome> allOutcomes) { Map<String, TestOutcome> scenarioOutcomes = new HashMap<>(); for (TestOutcome testOutcome : allOutcomes) { final String normalizedMethodName = normalizeMethodName(testOutcome); TestOutcome scenarioOutcome = scenarioOutcomeFor(normalizedMethodName, testOutcome, scenarioOutcomes); recordTestOutcomeAsSteps(testOutcome, scenarioOutcome); if (testOutcome.isDataDriven()) { updateResultsForAnyExternalFailures( testOutcome, scenarioOutcomes.get(normalizedMethodName)); scenarioOutcome.addDataFrom(testOutcome.getDataTable()); } } List<TestOutcome> aggregatedScenarioOutcomes = new ArrayList<>(); aggregatedScenarioOutcomes.addAll(scenarioOutcomes.values()); return aggregatedScenarioOutcomes; }
private boolean rowResultsAreInconsistantWithOverallResult(TestOutcome testOutcome) { TestResult overallRowResult = overallResultFrom(testOutcome.getDataTable().getRows()); return (testOutcome.isError() || testOutcome.isFailure()) && (!testOutcome.getDataTable().getRows().isEmpty()) && (testOutcome.getResult() != overallRowResult); }