public void PostAfterScenario(FeatureContext featureContext, ScenarioContext scenarioContext) { _stringWriter = new StringWriter(); Console.SetOut(_stringWriter); try { TestOutcome testOutcome = GetTestOutcomeFromScenarioExecutionStatus(scenarioContext.ScenarioExecutionStatus); string consoleOutput = _stringWriter.ToString(); string stackTrace = ThrownException?.Value?.ToString(); TestExecutionProvider.PostAfterScenario(testOutcome, featureContext.FeatureInfo.Title, scenarioContext.ScenarioInfo.Title, featureContext.FeatureInfo.Tags.ToList(), scenarioContext.ScenarioInfo.Tags.ToList(), consoleOutput, stackTrace); } catch (Exception ex) { TestExecutionProvider.BeforeFeatureFailed(ex); throw; } }