Specflow Scenario Outline - Change Auto Generated Test Name

1k views Asked by At

I'm writing BDD automation tests in Visual Studio 2019 using Specflow and running them using Nunit3.

When i write a Scenario Outline with an Examples table it looks like:

Scenario Outline: NP10_New_Record_Details_Tab_Info

Examples: 
| prod     | Desc         | date       | quantity |
| Prod010a | Product 010a | 01/10/2020 | 10.00    |
| Prod010b | Product 010b | 02/10/2020 |          |

The test name in Test Explorer then looks like:

Test Name:  NP10_New_Record_Details_Tab_Info("Prod010a","Product 010a","01/10/2020","10.00",null)
Test Name:  NP10_New_Record_Details_Tab_Info("Prod010b","Product 010b","02/10/2020","",null)

Is there any way i can manipulate the full test name so it doesnt show every column value of the examples table in the name? I've looked at some online suggestions like add a dummy column "Test_ID" to the Examples table then add '<TEST_ID>' to the scenario outline name but it only translates this as text not a parameter.

Is there a way of reconfiguring the full test name? - when I look at online advice I cant see other tests that display every column in brackets in the test name like mine do. Its not very readable.

1

There are 1 answers

0
Andreas Willich On BEST ANSWER

Copied answer from: https://support.specflow.org/hc/en-us/profiles/373373154558-Andreas-Willich


I think this is the way NUnit Scenarios are displayed. As far as I remember we tried to improve it (https://github.com/SpecFlowOSS/SpecFlow/pull/1874), but there was/is a problem with the test adapter, so we need to take the change back.

The SpecFlow+ Runner and xUnit have as far as I remember better test/method names in the test explorer for Scenario Outlines.