-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting Visual Studio Integration
You can enable SpecFlow tracing in Visual Studio from Tools / Options / SpecFlow. Once the tracing is enabled, there is a new SpecFlow pane added to the output window showing diagnostic messages.
-
Steps are not recognized even though there are matching step definitions
SpecFlow Visual Studio integration caches the step definition binding status. This cache might get corrupted causing unrecognized steps. To delete the cache, you have to do the following steps.
- Close all Visual Studio instances.
- Go to
%TEMP%folder and delete any files that are prefixed withspecflow-stepmap-, e.g.specflow-stepmap-SpecFlowProject-607539109-73a67da9-ef3b-45fd-9a24-6ee0135b5f5c.cache. - Reopen your solution.
By enabling tracing (see above), you might see some more specific error.
-
Tests are not displayed in the Test Explorer window when using SpecFlow+ Runner
Sometimes the Visual Studio Test Adapter cache gets corrupted, and the tests are not displayed. As a solution you can clean the cache with the following steps:
- Close all Visual Studio instances
- Go to
%TEMP%\VisualStudioTestExplorerExtensions\folder and delete any sub folders related to SpecFlow/SpecRun. - Reopen your solution and make sure it builds.
-
Unable to find plugin in the plugin search path: SpecRunwhen saving / generating feature filesSpecFlow searches for plugins in the NuGet packages folder. This is detected relative to the reference for the
TechTalk.SpecFlow.dll. If this dll is not loaded from the NuGet folder, the plugins are also not found.A typical problem is if the NuGet folder is not ready yet (e.g. not restored) when the solution is opened, but there is a
TechTalk.SpecFlow.dllin thebin\Debugfolder of the project. In this case, Visual Studio might load the assembly from thebin\Debugfolder instead of waiting for the NuGet folder properly restored. Once this has happened, Visual Studio even "remembers" that it loaded the assembly frombin\Debug, so reopening the solution might not help. The best way to fix this is:- Make sure the NuGet folders are properly restored.
- Close Visual Studio.
- Delete
bin\Debugfolder from the project(s). - Reopen solution in Visual Studio.
-
Tests are not displayed in the Test Explorer window when using SpecFlow+ Runner, after NuGet restore
The
SpecRun.RunnerNuGet package, that contains the Visual Studio Test Explorer adapter is a solution-level package (these packages were registered in the.nuget\packages.configfile of the solution). In some situations, NuGet package restore on build does not restore solution-level packages.To fix this, you can open the NuGet console or the NuGet references dialog and click on the restore packages button. After restoring the packages properly, you might need to restart Visual Studio.
-
VS2015: Tests are not displayed in the Test Explorer window when using SpecFlow+ Runner
It seems that VS2015 handles solution-level NuGet packages differently (these packages were registered in the
.nuget\packages.configfile of the solution). Now the solution-level NuGet packages have to be listed at the projects that use them, otherwise the Test Explorer will not recognize the test runner.To fix this issue, you have to either re-install the SpecFlow+ Runner NuGet packages, or simply add the dependency to the
SpecRun.Runnerpackage (<package id="SpecRun.Runner" version="1.2.0" />) to the packages.config file of the SpecFlow projects. You might need to restart Visual Studio to see the tests. -
VS2015: Tests turn to grayish green in the Test Explorer window when using SpecFlow+ Runner after test execution has been completed
This is a known cosmetic issue, we will address it later.