chutney-testing/chutney-legacy

๐Ÿ› | In chutney junit verify final status of an scenario

Closed this issue ยท 0 comments

In ScenarioDescriptor :

Verify if report status is not SUCCESS instead of just FAILURE.
For example if scenario is still running, it should failed.

    @Override
    public void after(ChutneyEngineExecutionContext context) throws Exception {
        FeatureDescriptor featureDescriptor = (FeatureDescriptor) this.getParent().get();
        featureDescriptor.addScenarioStatus(report.status);

        LOGGER.info("Scenario {} execution", this.getDisplayName());
        LOGGER.info("status : {}", report.status);
        LOGGER.info(om.writerWithDefaultPrettyPrinter().writeValueAsString(report));

        if (StatusDto.FAILURE.equals(report.status)) {
            StepExecutionReportDto failedStepReport = findFailedStep(report);
            throw new Exception(failedStepReport.name + ": " + failedStepReport.errors.stream().reduce((s, s2) -> String.join("\n", s, s2))
                .orElse("Scenario " + stepDefinition.name + " FAILURE")
            );
        }
    }