SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.25k stars 754 forks source link

Extent Reporting Framework & Parallel Execution With SpecFlow - Report Scenarios Getting Logged Under The Last Executed Thread #1768

Open ramgkn opened 4 years ago

ramgkn commented 4 years ago

Hi Team,

I am in the process of enabling Parallel Execution for One of My Project; however ended up in a situation where I am able to execute test cases parallelly but the ExtentReport is generating wearied report - all the Test Steps are logged under the last scenario that got executed; where as i have executed 3 separate feature files.

Solution that i am working on along with sample report attached. Tired to workout on couple of solution suggested in google with no luck . Can somebody give me direction on this.

ExtentReport_Local.zip

ParallelExecution.zip

ramgkn commented 4 years ago

Hi Team, I know support is quite busy; however, any direction that you can guide me with this issue.

ramgkn commented 4 years ago

Guys.. any recommendations.

SavitaMaurya commented 4 years ago

I have also seen this behavior in parallel execution, but kind of living with it :( Would be nice if it gets fixed.

ramgkn commented 4 years ago

Team,

Any recommendations.

Stephen-Mc commented 4 years ago

I've changed the title of this issue to reflect that you are having issues with Extent Reporting Framework (which is my understanding of the issue). Maybe that will attract more responses from others who have experience with Extent.

ramgkn commented 4 years ago

Thanks Stephen....

I was able to sort the issue out to a certain extend... @SavitaMaurya - Try following the link https://stackoverflow.com/questions/54191960/extent-report-for-parallel-testing-xunit-and-specflow

"[ThreadStatic] private static ExtentTest scenario;"

Should do the trick for you as well.. may be with some cosmetic changes witin your hooks/listener class.

ChrisWoodMHM commented 4 years ago

@ramgkn [ThreadStatic] worked for me but now my steps are written to random scenarios in the report. Did you ever get this working correctly?

ramgkn commented 4 years ago

At the end worked for me, it can be due to the context variables have not kept thread static.

Please check that , if still issue will give u a snippet for nunit

On Thu, 16 Jul, 2020, 19:38 ChrisWoodMHM, notifications@github.com wrote:

@ramgkn https://github.com/ramgkn [ThreadStatic] worked for me but now my steps are written to random scenarios in the report. Did you ever get this working correctly?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SpecFlowOSS/SpecFlow/issues/1768#issuecomment-659436875, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH4F22XLGCLHNN7X2A44JFLR34CWJANCNFSM4JI7LYSQ .

mjsegovia commented 3 years ago

Thanks Stephen....

I was able to sort the issue out to a certain extend... @SavitaMaurya - Try following the link https://stackoverflow.com/questions/54191960/extent-report-for-parallel-testing-xunit-and-specflow

"[ThreadStatic] private static ExtentTest scenario;"

Should do the trick for you as well.. may be with some cosmetic changes witin your hooks/listener class.

Thanks, I had the same issue and adding the [ThreadStaticAttribute] in the static ExtentTest, now the report works :)

shyam-nithyanandham commented 2 years ago

@ramgkn , I facing the same, but I in advanced stage, report is not generating for me. would you please share me the extent test part of the code, just wanted to understand how fearturecontext, scenario context are configured