Wednesday, December 15, 2010

App.config for SpecFlow using MsTest

Every time I need to configure MsTest to work with SpecFlow I forget the syntax of it... Especially the first part...

The fact that it took me about 30 min to write this post is evidence enough that I should not spend any more on this. Here is my reference:

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

<specFlow>
<unitTestProvider name="MsTest" />
</specFlow>
</configuration>

Also there is some additional config setting that you might want to tweak. Here is a complete version with default values:

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

<specFlow>
<unitTestProvider name="NUnit" />

<language feature="en-US"/>

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

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

3 comments:

Unknown said...

Sweet. Thanks!

Anonymous said...

I keep being told to add a
stepAssemblies section in order to link to steps located in an external project. Unfortunately, this doesn't seem to work and I keep getting a "Unrecognized element 'stepAssemblies'" error?

Do you perhaps know what I am doing wrong?

The document I have seems to indicate that no such thing as "stepAssemblies" exists :(

Marcus said...

Hmmm when I get that error I usually has forgot the specflow configuration section ( <section name="specFlow" ....)

If I couldn't get that to work I would download an example and try it out. Check out the feature test for SpecFlow itself that has tests for external assemblies. You'll find it on http://Github.com/techTalk/specFlow