I have installed Visual Studio 2012 Ultimate Edition and configured SpecFlow. I have used the following configuration to run the tests in config.xml file:
<specFlow>
<unitTestProvider name="MsTest" />
</specFlow>
I was able to create the testes and compile properly. But when I tried to run the scenarios from the context menu with the option "Run SpecFlow Scenarios" or "Debug SpecFlow scenarios", I am not able to see any action. It just says "Build succeeded" and nothing else happens later.
Can someone kindly explain if there is any other way of executing the scenarios?
Thanks in advance.
To enable the extension in Visual Studio, select Tools | Extensions and Updates…, select the “SpecFlow for Visual Studio” extension, then select Enable.
In order to execute your SpecFlow tests, you need to define the tests as Gherkin feature files, bind the steps defined in your feature files to your code, and configure a unit test provider to execute the tests. SpecFlow generates executable unit tests from your Gherkin files.
Files needed for test SpecFlow tests typically consist of two files, your Feature file and your Step Definitions. Your feature file is where you will be coding out your scenarios, and your step definitions file is where you define how your test behaves.
I already had all this configuration set, but I was still not able to get the scenarios to run from the context menu.
Until I reviewed the SpecFlow options (Tools > Options > SpecFlow) and set "VisualStudio2012" as Test Runner Tool (under Test Execution).
For some reason it was set on "VisualStudio2010MsTest" and then the scenarios didn't run from the context menu.
Your app.config file should be:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
</configSections>
<specFlow>
<unitTestProvider name="MsTest" />
</specFlow>
</configuration>
Here is a link to SpecFlow wiki.
Then re-build your solution and you should be able to see and run the tests. You can see and run your tests from Test/Windows/Test Explorer.
Also make sure that you have a reference to: Microsoft.VisualStudio.QualityTools.UnitTestFramework from your test project. Here are the steps:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With