SpecFlow.VisualStudio icon indicating copy to clipboard operation
SpecFlow.VisualStudio copied to clipboard

Ability to highlight unused step definitions in Step.cs files

Open PaulInglis opened this issue 6 years ago • 1 comments

SpecFlow Version:

  • [x] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Used Test Runner

  • [ ] SpecFlow+Runner
  • [ ] MSTest
  • [ ] NUnit
  • [x] Xunit

Version number: xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 4.6.27817.03)

Project Format of the SpecFlow project

  • [ ] Classic project format using packages.config
  • [x] Classic project format using <PackageReference> tags
  • [ ] Sdk-style project format

.feature.cs files are generated using

  • [x] SpecFlow.Tools.MsBuild.Generation NuGet package
  • [ ] SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • [x] VS 2019
  • [ ] VS 2017
  • [ ] VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • [x] Enabled
  • [ ] Disabled

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No, I use Visual Studio version <Major>.<Minor>.<Patch>

.NET Framework:

  • [ ] >= .NET 4.5
  • [ ] before .NET 4.5
  • [ ] .NET Core 2.0
  • [ ] .NET Core 2.1
  • [x] .NET Core 2.2
  • [ ] .NET Core 3.0

Test Execution Method:

  • [x] Visual Studio Test Explorer
  • [ ] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [ ] Command line – PLEASE SPECIFY THE FULL COMMAND LINE

Issue Description

Our project is getting large and it would be good to be able to detect which steps are no longer used by a line in a .feature file. I read that you can use the Specflow Reporting feature, but that doesn't exist in v3, which is what I'm using. I see it working in the same way Visual Studio highlights unused methods or variables.

PaulInglis avatar Jul 10 '19 14:07 PaulInglis

Although this is not the same solution, it might be useful to know about that SpecFlow+ LivingDoc now supports displaying unused step definitions.

You need to install or update to the latest SpecFlow.Plus.LivingDoc.CLI NuGet package (as of writing: 3.5.186).

Further read:

  • How to install the CLI tool: https://docs.specflow.org/projects/specflow-livingdoc/en/latest/LivingDocGenerator/Installing-the-command-line-tool.html
  • Unused step definitions: https://docs.specflow.org/projects/specflow-livingdoc/en/latest/LivingDocGenerator/Unused-step-definition-report.html

ozslab avatar Dec 08 '20 17:12 ozslab