Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use Specflow with Resharper?

I have just added a specflow feature however the generated code is for NUnit. I would prefer to use Resharper to run the tests.

I installed specflow from NuGet. I did not install any runner projects.

Here is a sample of the generated .feature.cs

//
------------------------------------------------------------------------------ //  <auto-generated> //      This code was generated by SpecFlow (http://www.specflow.org/). //      SpecFlow Version:1.9.0.77 //      SpecFlow Generator Version:1.9.0.0 //      Runtime Version:4.0.30319.18444 //  //      Changes to this file may cause incorrect behavior and will be lost if //      the code is regenerated. //  </auto-generated> //
------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable namespace Test.FeatureHanding {
    using TechTalk.SpecFlow;


    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")]
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [NUnit.Framework.TestFixtureAttribute()]
    [NUnit.Framework.DescriptionAttribute("Set Filter")
like image 983
Kirsten Avatar asked Aug 01 '14 22:08

Kirsten


2 Answers

By default, all SpecFlow tests are in NUnit! SpecFlow simply generates the tests from the plain text for you.

You simply have to click on the icon to the left of the test method declaration in the generated YourFeature.feature.cs file, or you Resharpers test explorer to find it.

like image 99
AlSki Avatar answered Sep 27 '22 19:09

AlSki


I think there is a terminology misunderstanding here.

NUnit is a testing framework (others are xUnit, mbUnit, MSTest). NUnit comes with a test runner which can run unit tests written with the NUnit framework.

Resharper has a test runner which can run tests from many testing frameworks (all of the above frameworks I believe). There are other test runners available. Visual studio (2012+ I believe) come with a test runner which can run MSTest tests without a plugin. NCrunch can run tests from any of the frameworks, and xUnit and mbUnit probably have runners provided which can run tests written in those frameworks.

Once you have built your feature files then Resharper should find the tests that SpecFlow has generated.

like image 39
Sam Holder Avatar answered Sep 27 '22 18:09

Sam Holder