Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

SpecFlow Tests
richardmoss
#1 Posted : Tuesday, July 9, 2019 4:23:37 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/1/2012(UTC)
Posts: 12

Thanks: 3 times
Was thanked: 4 time(s) in 4 post(s)
Hello,

I'm busy working my way through a book which presents a bunch of test cases in Gherkin, so I've been using SpecFlow to implement them and then using Visual Studio's test runner to run them. Except VS's test runner still sucks and I wondered if NCrunch supported SpecFlow. Apparently it does, but I can't get it to to work - the only tests that are detected and executed are three "normal" MSTest tests I created.

I noticed that if I opened the Feature files, NCrunch is showing code coverage markers next to all the test steps, although it states that no tests are covered - yet there's currently 101 of them.

The test project is a .NET Core 2.1 project. The classes being tested are in a .NET Standard 2.0 project. NCrunch doesn't appear to be issuing any warnings or have any problems with the project - as I noted, it's quite happy running 3 old school tests in the same solution. Just in case it was getting confused and only processing one set of tests, I tried deleting the standard tests so only the SpecFlow ones remained, to no avail.

Can you offer any suggestions on how I get NCrunch to run the SpecFlow tests?

Regards;
Richard Moss

[I did search the docs, but not hits for "SpecFlow". Searched the forums, plenty of posts from which I gather it's supposed to "just work"]
michaelkroes
#2 Posted : Tuesday, July 9, 2019 7:12:16 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Hi,

Thanks for posting. With SpecFlow 3 there are some extra nuget packages that are required to run the tests.

https://specflow.org/doc...ntation/NuGet-Packages/

SpecFlow.Tools.MsBuild.Generation <= this is an important one for NCrunch. We need to generate the code during our builds and store them in the workspace.

Would you mind checking if that is installed?
1 user thanked michaelkroes for this useful post.
richardmoss on 7/9/2019(UTC)
richardmoss
#3 Posted : Tuesday, July 9, 2019 8:14:52 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/1/2012(UTC)
Posts: 12

Thanks: 3 times
Was thanked: 4 time(s) in 4 post(s)
Hello,

Thanks for the response. I did have the correct packages installed based on the specflow docs that I'd followed (first time using this framework, normally a nunit guy!), but on a whim I commented out the specrun.specflow packagereference and replaced it with specflow.mstest instead and immediately NCrunch kicked in and picked up all the tests. And as a bonus, the tests run immediately instead of having a forced 10 second delay the way the specrun package was apparently doing (that sort of behaviour isn't conducive to a nice debugging experience when you have failing tests!).

Thanks again for the pointer, definitely a relief to be get rid of the awful VS runner and be back in business with NCrunch.

Regards;
Richard Moss
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.028 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download