Running NUnit3 tests using fake

Reading time ~1 minute

When you have some unit tests developed using NUnit 2.x your FAKE script looks like something like this:

1
2
3
4
Target "RunUnitTests" (fun _ ->
    !! (testDir + "/*.Tests.dll")
    |> NUnit (fun p ->
          {p with ToolPath = "packages/NUnit.Runners/tools/"}) )

But NUnit3 works slightly different. Instead of having a single NUnit.Runners package, that package references some other packages (runner, extensions, etc). One of those packages is NUnit.ConsoleRunner that has the exe inside the tools folder.

But changing the ToolPath in the FAKE task is not enough. You should use the new NUnit3 action, which is inside the Fake.Testing module. So, we need to open the module and change the task definition:

1
2
3
4
5
6
let nunitRunnerPath = "packages/NUnit.ConsoleRunner/tools/nunit3-console.exe"

Target "RunUnitTests" (fun _ ->
    !! (testDir + "/*.Tests.dll")
    |> NUnit3 (fun p ->
        {p with ToolPath = nunitRunnerPath}) )

And hopefully when you run the FAKE script you’ll have something like this:

NUnit3 Results

Dynamic secrets with Vault

In the [previous](http://vgaltes.com/devops/vault-basics) article we saw how we can configure [Vault](https://vaultproject.io) and write ...… Continue reading

Vault basics

Published on December 16, 2017

Analysing hotspots using CrystalGazer and NDepend

Published on November 07, 2017