6

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.

Sender
  • 6,660
  • 12
  • 47
  • 66
Ken
  • 207
  • 3
  • 9
  • 1
    You should include your code (feature files directly as text (indented with 4 spaces so that the markup sees it as code)). – Benoît Oct 13 '15 at 09:58
  • 1
    look at http://stackoverflow.com/editing-help#code It will not be perfect Cucumber like formatting, but will be more readable than an image. Note that users might want to copy-paste your code to test it before answering. Also look at [mcve] – Benoît Oct 13 '15 at 10:09
  • 1
    are you using MSTest or another unit testing framework with specflow? – Sam Holder Oct 13 '15 at 11:53

1 Answers1

6

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.

AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47
Andrei Mihalciuc
  • 2,148
  • 16
  • 14
  • 2
    Forgot to mension - "Test_ID" column should be first – Andrei Mihalciuc Oct 15 '15 at 15:14
  • 1
    My test names on Scenario Outlines look like: NP10_New_Record_Details_Tab_Info("Prod010a","Pr010a","01/10/2020","10.00",null) I cant seem to stop the full example table row being added to the test name in brackets – m_finn Oct 13 '20 at 11:53