3
votes

How do I get my App.config file to be recognized/used by the NUnit GUI runner? I have tried placing it in the top folder of my project and in the same folder as my feature files. Here are the contents of my App.config file:

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

  <specFlow>
    <runtime detectAmbiguousMatches="true"
             stopAtFirstError="false"
             missingOrPendingStepsOutcome="Error" />
  </specFlow>
</configuration>

Specifically I am trying to tell NUnit to have a fail result when there is a missing or pending step which is why I am specifying "Error" for this. This actually works correctly when I use TestDriven.net but not when I use the NUnit GUI runner. The GUI always shows a green bar and displays the test as Inconclusive instead of Error or Failed.

I am launching the GUI with this command line argument:

E:\Program Files\NUnit 2.5.5\bin\net-2.0\nunit.exe "E:\ACSreader new work\ACSreader2 Working Copy\trunk\ACSreader2\ACSreader2.sln" /config:Test

2
I discovered the problem is specific to the NUnit GUI runner, so I updated my original poststill_dreaming_1

2 Answers

3
votes

Update concerning NUnit GUI Runner:

NUnit-Runner seems not to properly display/report inconclusive tests. An inconclusive test is displayed green in NUnit-GUI, while TestDriven and ReSharper display it yellow.

As shown in the question, SpecFlow can be configured to report missing steps as Errors and not as Inconclusive.

The configuration happens in the App.config of the project that contains the feature-files. The usual mechanism for App.config in .NET is applied. That means at runtime the config info has to be in a file called .dll.config. The runtime provides then the config to SpecFlow. SpecFlow does not read the config itself from App.config!

Make sure that at runtime the correctly named config file is present alongside the dll that contains the test fixtures. VisualStudio usually does that transparently when building a project.


Original answer:

The App.config has to be in the root folder of the project that is containing the test-fixtures (the project that contains the feature files).

Have a look at the examples on github. There are several App.config files in different projects:

http://github.com/techtalk/SpecFlow-Examples/tree/master/ASP.NET-MVC/BookShop/BookShop.AcceptanceTests/

http://github.com/techtalk/SpecFlow-Examples/tree/master/ASP.NET-MVC/BookShop/BookShop.AcceptanceTests.Selenium/

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

0
votes

See my answer nunit and configs You need to tell nunit what the name of the config file is. it looks for namespace.config by default it seams