Specflow error: Force regenerate steps possible?

后端 未结 11 1789
猫巷女王i
猫巷女王i 2021-02-01 14:32

Is it possible to \"force\" regenerate step definitions for a specflow feature file? I have created this feature file but cannot generate all steps. Am getting a message that al

相关标签:
11条回答
  • 2021-02-01 15:16

    Right-click the .feature file and chose "Run Custom Tool". That will rerun the SpecFlowSingleFileGenerator that generates the code-behind in the test framework of your choice.

    0 讨论(0)
  • 2021-02-01 15:17

    You can regenerate all feature file test classes using the SpecFlow-provided tool specflow.exe.

    Assuming that SpecFlow has been installed through NuGet and is in the ./packages directory relative to your current directory, you can run, in the terminal, the command

    .\packages\SpecFlow.X.Y.Z\tools\specflow.exe generateall path\to\myfile.csproj
    

    which will regenerate all feature file unit tests. As the linked page states, you can add the /force flag to force regeneration of all tests.

    0 讨论(0)
  • 2021-02-01 15:20

    Restarting VS is cumbersome especially if you have big project.

    We changed code of specflow plugin (https://github.com/techtalk/SpecFlow). Added command that reinitializes scope (refer to method EnsureInitialization) and cleans chached file.

    Now we just click on button when bindings are changed.

    0 讨论(0)
  • 2021-02-01 15:21

    If you've been having problems with Specflow bindings such as:

    • steps are not recognized
    • no bindings could be found

    and restarting Visual Studio or regenerating the bindings doesn't work, then the SpecFlow Troubleshooting Visual Studio Integration has various solutions for Visual Studio 2013 and 2015.

    0 讨论(0)
  • 2021-02-01 15:25

    Another one to check that fooled me is have you left the pending placeholder code in place (opps):

    ScenarioContext.Current.Pending();
    

    will flag the test as not implemented.

    0 讨论(0)
提交回复
热议问题