Closed Naweap closed 2 years ago
You can inject ISpecFlowOutputHelper and then call WriteLine method that will output the message into the report.
You can inject ISpecFlowOutputHelper and then call WriteLine method that will output the message into the report.
I actually have the following code :
[AfterTestRun]
public static void AfterTestRun(ISpecFlowOutputHelper specFlowOutputHelper)
{
specFlowOutputHelper.WriteLine("blablabla");
//Console.WriteLine("blablabla");
}
It goes through the AfterTestRun function but doesn't display the given string inside the report.
Note : I use a custom report template
The SpecFlow+Runner implementation of the ISpecFlowOutputHelper uses Console.WriteLine in the background. So there is no difference. Output in the TestRun hooks aren't displayed, because it can't be assigned to a scenario. It is the same for Feature hooks.
You have this problem with all test runners. It is not limited to the SpecFlow+Runner.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
SpecFlow Version
3.9.7
Which test runner are you using?
SpecFlow+ Runner
Test Runner Version Number
3.9.7
.NET Implementation
.NET Core 3.1
Project Format of the SpecFlow project
Classic project format using
packages.config
.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
Visual Studio Test Explorer
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
I would like to output some information in the report when all tests have been executed. I used the [AfterTestRun] hook to do that.
Unfortunately, my Console.WriteLine output does not seem to appear in the report. Even when I'm printing some basic informations eg :
So I had to use the [AfterStep] hook and do tricky in order to archive my goal.
Are you aware of this issue and is there a solution to be able to print informations inside my report from the [AfterTestRun] hook ?
Thanks in advance
Steps to Reproduce
Link to Repro Project
No response