Name generation for scenario outlines in NUnit 3.X
Hi everyone, I think i found some issue with the name generation for NUnit 3.x in combination with "scenario outlines".
According to 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 this, I have definded the following dummy-scenario:
Scenario Outline: Some Scenario
When I am doing <x>
Then the action <y> happens
Examples:
| description | x | y |
| testcase1 | 1 | 1 |
| testcase2 | 2 | 2 |
I'd expect the UnitTest Name now to be shown as SomeScenario_testcase1
But actually it shows like SomeScenario("testcase1","1","1",System.String[] ).
the example i posted above generates to the following Nunit3 code:
[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])]
I am not sure, but I think the behavior of NUnit seems to be correct here, because in the documentation it says the following about NUnit's "TestCase" Attribute:
TestName provides a name for the test. If not specified, a name is generated based on the method name and the arguments provided.
So the code should more look like
...
[NUnit.Framework.TestCaseAttribute("testcase1", "1", "1", new string[0], TestName= "SomeScenario_testcase1")
...
Please correct me if I am wrong.. Thanks!
#1874
Merged so this one could be closed :)
But we reverted #1874 because of an issue in the NUnit3TestAdapter. So this is still open.
@304NotModified we also heve discussion in https://github.com/SpecFlowOSS/SpecFlow/pull/1874
Do you have any updates here? Can https://github.com/SpecFlowOSS/SpecFlow/pull/1874 be pushed?
As I understand SF is not in active development now.