是否可以使用Specflow with Resharper?

时间:2014-08-01 22:01:35

标签: resharper specflow

我刚添加了一个specflow功能,但生成的代码适用于NUnit。我更愿意使用Resharper来运行测试。

我从NuGet安装了specflow。我没有安装任何跑步项目。

以下是生成的.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")

2 个答案:

答案 0 :(得分:9)

默认情况下,所有SpecFlow测试都在NUnit中! SpecFlow只是为您生成纯文本的测试。

您只需在生成的YourFeature.feature.cs文件中单击测试方法声明左侧的图标,或者单击Resharpers test explorer查找它。

答案 1 :(得分:6)

我认为这里有一个术语误解。

NUnit是测试框架(其他是xUnit,mbUnit,MSTest)。 NUnit附带了一个测试运行器,可以运行用NUnit框架编写的单元测试。

Resharper有一个测试运行器,它可以运行来自许多测试框架的测试(我相信所有上述框架)。还有其他测试跑步者可用。 Visual Studio(2012+我相信)带有一个测试运行器,可以在没有插件的情况下运行MSTest测试。 NCrunch可以从任何框架运行测试,xUnit和mbUnit可能提供了运行程序,可以运行在这些框架中编写的测试。

构建完要素文件后,Resharper应找到SpecFlow已生成的测试。

相关问题