1

I have a specflow scenario, which is a scenario outline with two examples. In Test Explorer window of Visual Studio 2013 I can see it as two separate tests (which is ok), but "Open test" command from context menu doesn't work for them, while it does work for simple specflow scenarios (not "outline" scenarios). Is it somehow possible to quickly open code for such outline scenarios from Test Explorer window in Visual Studio 2013? Or does any other way exist to do that?

P.S. I use SpecFlow integration for Visual Studio 2013

alika
  • 13
  • 3

1 Answers1

0

The current version of specflow has some issues mapping code lines for scenario outlines. This pull request has a fix for this and was merged (via this PR) in the vNext branch. I have a version with this fix in it installed and I have just checked and when I choose 'Open Test' or double click on a test in the test explorer I get taken to the scenario line in the test explorer.

In order to use it you'll need to build a version of specflow yourself I thin from the 'v2' branch, at least until a beta version is published on nuget.

In order to use the v2 branch you need to checkout the code and build it. As a result of this you should end up with a nuget package in \SpecFlow\Installer\NuGetPackages\bin\. You will probably want to update the version number in the specflow.nuspec so that you get a proper version number. Once that's done you need to put the nuget package in a folder and then tell visual studio the that folder is a nuget source. Then you can install the nuget package (after uninstalling the old one) and you should be good to go. If it doesn't work then it might be because the extension needs to be updated. Searching the machine for the specflow dlls and replacing them with the newly built versions is probably the best way to go, as the ide integration is a separate package now.

Any other problems let me know, I'll do what I can to help.

Community
  • 1
  • 1
Sam Holder
  • 32,535
  • 13
  • 101
  • 181
  • Thanks for your answer. Need to check this. I've downloaded "v2" branch (is it specflow 1.7.1 version, which is not the latest??) and built it. How can I make now my tests project to use it? I have "Specflow for Visual Studio 2013" installed as extension and Specflow 1.9.0 package installed in Visual Studio by "Manage NuGet Packages". Do I need to unistall/remove all this and add a new reference to TechTalk.Specflow.dll from "v2" branch manually to my project? I've tried this, but build is failing now with messages like "...'WhenAttribute' not found..." and others. When I tried to ... – alika Apr 24 '15 at 07:52
  • ... use reference to other TechTalk.Specflow.dll from "v2" branch (which one dll do I need, as there are several in "v2" branch?) I got "No overload for method 'When' takes 4 arguments" and so on. P.S. In App.config I have `
    `
    – alika Apr 24 '15 at 07:52
  • @alika, I've updated the answer to include some instructions. please have a read. Also as you are new you may want to [check out how the site works](http://stackoverflow.com/tour). – Sam Holder Apr 24 '15 at 08:19
  • Still couldn't resolve this. I've removed previously installed SpecFlow package. I've prepared new package as you described. Then I've set everything in Visual Studio like described [here](http://stackoverflow.com/questions/10240029/how-to-install-a-nuget-package-nupkg-file-locally). In "Manage NuGet Packages" window among new packages to install from my source "SpecFlow" was marked as "Prerelease". Is it ok? I've tried to install it. It then looked like installed package, but there was no reference to TechTalk.SpecFlow.dll automatically added for my tests project. ... – alika Apr 24 '15 at 14:03
  • .. Then I uninstalled this package and for check purposes tried to install SpecFlow.NUnit package (it was also available) in my package source. Together with that SpecFlow package itself also was automatically installed. Reference to TechTalk.SpecFlow.dll also was automatically added (although not every time I tried, and I've tried for several times). But build, anyway, was not successfull. Then I've tried to replace all other old SpecFlow dlls I had before with new ones, as you suggested, but I'm not sure these were the ones I needed to replace. Didn't helped. ... – alika Apr 24 '15 at 14:03
  • .. Still getting "Error 112 The type or namespace name 'WhenAttribute' could not be found (are you missing a using directive or an assembly reference?)", "Error 113 The type or namespace name 'When' could not be found (are you missing a using directive or an assembly reference?)" and other similar error messages. – alika Apr 24 '15 at 14:03
  • maybe you'll just have to wait for the next relaese then. I have it working from a version that I built. Not sure what else to suggest... – Sam Holder Apr 24 '15 at 14:05
  • I guess it's not the initial question anymore, but more about how to get my own package "work". :) If the initial question is really a SpecFlow issue itself and there is a fix, maybe it's worth just to wait for official release.. But waiting can be probably long.. – alika Apr 24 '15 at 14:08
  • there is a push to get a new version out, and work has been going on in the v2 branch for a couple of months. Ideally I'd like us to get a beta version out ASAP – Sam Holder Apr 24 '15 at 14:09