7

SpecFlow のテスト ランナーとして xUnit.net を使用しようとしています。公式ダウンロード エリアの SpecFlow 1.2 バイナリには xUnit.net プロバイダーが含まれていませんが、GitHub のマスター ブランチには xUnit.net プロバイダーが含まれているため、そこから SpecFlow.Core.dll をビルドします。xUnit.net 1.5 を使用しています。

ただし、spec プロジェクトの app.config で unitTestProvider 名を変更すると、null 参照カスタム ツール エラーが発生し、生成された .feature.cs ファイルは次の 1 行になります。

Object reference not set to an instance of an object.

SpecFlow を xUnit.net で動作させることに成功した人はいますか? もしそうなら、どのように?

4

3 に答える 3

12

私はちょうど同じ問題に遭遇し、答えを見つけました。SpecFlowのlatesdistを使用するだけで、1.3.5.2を使用しています。次に、xUnit.dllへの参照を追加し、次の構成でSpecsプロジェクトにApp.configファイルを作成するだけです。

<?xml version="1.0" encoding="utf-8" ?>
  <configuration>
    <configSections>
       <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
    </configSections>

    <specFlow>
       <language feature="en-US" />
         <unitTestProvider name="xUnit" />

         <runtime detectAmbiguousMatches="true" stopAtFirstError="false"
                 missingOrPendingStepsOutcome="Inconclusive" />

         <trace traceSuccessfulSteps="true" traceTimings="false"
             minTracedDuration="0:0:0.1" />
    </specFlow>
  </configuration>

ここでトリックを実行しているのは、unitTestProvider要素です。

于 2010-09-11T19:57:54.177 に答える
7

SpecFlow 1.3以降、xUnitがサポートされています。 http://groups.google.com/group/specflow/browse_thread/thread/e3d593a52aa17a15

于 2010-06-16T17:23:00.397 に答える
5

There is an example for SpecFlow with xUnit in the SpecFlow-Example repository:

http://github.com/techtalk/SpecFlow-Examples/tree/master/BowlingKata/BowlingKata-XUnit

In order to run it, you have to build SpecFlow from the latest sources on github (master branch). You also should have installed SpecFlow 1.2 in order to get proper VisualStudio integration. Then replace all the assemblies in you installation directory (default Program Files (x86)\TechTalk\SpecFlow) with the assemblies built from source.

After this you should be able to build and run the above SpecFlow-Example project.

Hope this helps?

于 2010-04-30T21:10:20.593 に答える