SpecFlow
SpecFlow copied to clipboard
Livingdoc: Custom step definition not included in HTML's list of unused step definitions
SpecFlow Version
SpecFlow 3.9.74 and livingdoc 3.9.57
Which test runner are you using?
MSTest
Test Runner Version Number
2.2.10
.NET Implementation
equal or greater .NET Framework 4.6.1
Project Format of the SpecFlow project
Sdk-style project format
.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
Visual Studio Test Explorer
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
The analytics tab in the HTML document shows a badge with a number of unused step-definitions. However, the list does not show any unused step-defs. When I choose JSON output instead of HTML, then I do see the details of each unused step-def in the array.
This occurs for methods decorated with a custom attribute derived from StepDefinitionBaseAttribute
. The normal Given
, When
, Then
and StepDefinition
attributes work fine.
Steps to Reproduce
Define a custom step-definition attribute like this:
public class SpecFlowActionAttribute : StepDefinitionBaseAttribute
{
public SpecFlowActionAttribute() : this(null) { }
public SpecFlowActionAttribute(string regex) : base(regex, new[] { StepDefinitionType.Given, StepDefinitionType.When }) { }
public SpecFlowActionAttribute(string regex, string culture) : this(regex) { Culture = culture; }
}
Create a new step-definition with this new attribute, but do not use it in any feature file. Run the tests.
Create the living doc using a command-like this livingdoc.exe feature-folder . --binding-assemblies <all relevant assemblies here>
Link to Repro Project
No response