TotalTest / SpecFlow.Contrib.Variants

SpecFlow plugin to allow variants of a test to be run using tags e.g. against different browsers
MIT License
3 stars 7 forks source link

Scenario displayed only once in LivingDoc report due to identical scenario title for multiple browsers #8

Closed CNIstrate closed 3 days ago

CNIstrate commented 1 month ago

Having multiple browsers will output the given browser number of results in the report .json file. Due to the scenario title not being different between browsers, the report will only contain the first result for the first browser mentioned in tags.

Is there any way to incorporate the browser from the tag, for example, @ Browser:Chrome -> Chrome_{Scenarion_Title), in the scenario title?

Thanks!

TotalTest commented 1 month ago

The scenario title does currently append the variant (browser in your case). e.g. image

Could you provide more details?

criistra commented 1 month ago

Hi!

image image

TestExecution.json: image

Generated .cs file: image

Packages: image

This is how it looks in living doc. image

It says the test ran 3 times, but I cannot see the results for all of them. I guess if the scenario name can be adapted to include the browser name in ScenarioInfo, it will also show show all runs in LivingDoc. image

TotalTest commented 1 week ago

Hi @criistra, I have publshed a pre-release version to cater for the above. Please could you give it a go and let me know if it solves your problem?

dotnet add package SpecFlow.Contrib.Variants --version 3.9.90-pre.2

CNIstrate commented 1 week ago

Hi @TotalTest, now the browser is added in the ScenarioInfo and it's also displayed in the TestExecution.json file.

The new problem is that LivingDoc does doesn't know how to match the scenario title from the .feature file with the scenario names from the TestExecution.json.

For example, if the scenario title from the .feature file is "Some scenario title" and the scenario title from the TestExecution.json is "Some scenario title: Chrome", livingdoc won't match them to have results, so the .html is generated without test execution results. image

Removing the additional ": {browser.name}" from the TestExecution.json file for each scenario will lead back to the old issue in which the results are not displayed separately for each browser.

I can live with it, I will skip using LivingDoc and rely on the .TRX file which displays all results properly in Azure, for each browser. image

I do not think there is something else that can be done from your side. I believe it's ok to revert those changes if it doesn't help on your side with something else.

Thank you!

TotalTest commented 3 days ago

Yeah it seems living doc doesn't take scenario names from the generated code behind files so it won't know about the variants.

I think it's still correct to have these changes in as the scenario info does actually represent the test.