Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to improve the auto generated name in specflow when use scenario outline

I'm just a newbie in testing with Specflow and I have an issue when I use Scenario Outline.

My feature file as following: feature file feature file and below is the name is auto generated name. name

I just want to append the Test case ID for each row in the table outline, is there any way to control this?

I do this because the number of test case I need to test can up to 1000. So if I can append the test case ID in the suffix of the name that Specflow auto generate, I can save the time for mapping the test case to the test result.

like image 700
Ken Avatar asked Oct 13 '15 09:10

Ken


Video Answer


1 Answers

Add a new column to "Examples" section (you can call it like "Test_ID"), fill it in with unique values. It should append your id to the end of the test name. It works in our case.

Or, as stated in the documentation:

For better traceability, the generated unit test method names are derived from the scenario outline title and the first value of the examples (first column of the examples table). It is therefore good practice to choose a unique and descriptive parameter as the first column in the example set. As the Gherkin syntax does require all example columns to have matching placeholders in the scenario outline, you can even introduce an arbitrary column in the example sets used to name tests with more readability.

like image 150
Andrei Mihalciuc Avatar answered Sep 29 '22 05:09

Andrei Mihalciuc