A little while back I wrote a post on achieving concurrent or parallel test running with Selenium, Specflow and NUnit2, but what about NUnit3? Let's have a look at that, thankfully it is a bit simpler than running an external build script as done previously. First up, according to the Specflow docs - open up your AssemblyInfo.cs file in your project and add the following line: [cc lang="c#" widt...
Adding Pickles to your Project is really useful for presenting your Gherkin based tests in an easy to read, searchable format with some funky metrics added in. If you get your CI build to publish the output as an artifact then on each build you will always have up to date current documentation of what is being tested.
You can configure it numerous ways, via MSBuild, PowerShell, GUI or Command Line.
In this article I will be setting up via command line and running a batch file as a build step in TeamCity. First off we need to Install Pickles Command Line via NuGet. NUnit 3 is my test runner.
Once built we can start making use of it by running the executable with our desired parameters:
- –feature-directory: Where your Feature Files live, relative to the executable
- –output-directory: Where you want your Pickles report to generate
- –documentation-format: Documentation format (DHTML, HTML, Word, Excel or JSON)
- –link-results-file: Path to NUnit Results.xml (this will allows graphs and metrics)
- –test-results-format: nunit, nunit3, xunit, xunit2, mstest, cucumberjson, specrun, vstest
Together it looks like the below, which is put into a batch file and called in a closing build step.
.\packages\Pickles.CommandLine.2.5.0\tools\pickles.exe –feature-directory=..\..\Automation\Tests\Project.Acceptance.Tests\Features^ –output-directory=Documentation^ –link-results-file=..\..\..\TestResult.xml –test-results-format=nunit –documentation-format=dhtml
I use the NUnit format over NUnit3 because I have set my NUnit3 runner to output NUnit2 formatted results, this is so Specflow can consume the same output and produce more metrics on the build. With the results file hooked in you can get some whizzy graphics:
Pickles is a great tool for BDD and should help bridge that gap between “the Business” and IT. A full sample report can be found here. You can find extensive documentation here for the various ways to set up Pickles.