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.
Scenario Outline: Some ScenarioWhen I am doing <x>Then the action <y> happens
Examples: | description | x | y || testcase1 | 1 | 1 || testcase2 | 2 | 2 |
--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("Some Scenario")] [NUnit.Framework.TestCaseAttribute("testcase1", "1", "1", new string[0])] [NUnit.Framework.TestCaseAttribute("testcase2", "2", "2", new string[0])] public virtual void SomeScenario(string description, string x, string y, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Some Scenario", exampleTags);#line 6this.ScenarioSetup(scenarioInfo);#line 7testRunner.When(string.Format("I am doing {0}", x), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");#line 8testRunner.Then(string.Format("the action {0} happens", y), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");#line hidden this.ScenarioCleanup(); }
TestName provides a name for the test. If not specified, a name is generated based on the method name and the arguments provided.
I'm having exactly the same problem with Specflow and Nunit3. My scenario outlines test names look like:
NP10_New_Record_Details_Tab_Info("Prod010a","Product 010a","01/10/2020","10.00",null)I need to make them more readable than listing every column of the Example table row in the test name
Was there a solution to this?
--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/specflow/a6537a38-b7b1-41e7-a852-1758018d9903n%40googlegroups.com.