NZJames
NZJames

Reputation: 5055

Using NUnit as a deployable test suite

I have used NUnit a lot in unit testing scenarios for developer based testing, but what I would like is to leverage the GUI and test capabilities to provide my QA team with a test suite they can run for all components or partial components etc, as the GUI is perfect for that.

But what I am stuck trying to work out is how to model it in my solution, what I need to deploy, how to deploy NUnit etc.

I was going to have a class library for the tests, a console app that is run by the QA team and they can pass parameters for either running a subset of tests automatically which would spawn the NUnit console and run those tests, or if they just run my console app with no params, it loads up the NUnit GUI and they can browse for whatever tests they like.

But as NUnit is deployed as a large binary project, that needs to be run by Process.Start, Im not sure how to deploy it as NUnit has a large directory structure, im not sure how to include that in my project build, where it will be, etc.

Has anyone done something similar and have any advice on how best to do this?

Upvotes: 2

Views: 673

Answers (1)

jimbobdog
jimbobdog

Reputation: 121

One way of deploying the nunit binaries is with NuGet - there is a NUnit.Runner nuget package that has all the binaries, gui etc in it - you just need to supply the testable binaries.

So - in your CI/build process create a step that will create a nuget package containing just your test & supporting assemblies. In the .nuspec file make "NUnit.Runner" a dependent package. Now you have a nuget package that contains all your stuff and links to all the NUnit .exes you need...the next challenge is to get this package onto your testers desktop. The best way of doing this is with your own private NuGet feed/server or NaaS...myget.org.

At this point I will say that I created the following solution - I think there are others available, chocolatey for instance does the same.

I built a nuget package called "sidewinder" (sidewinder.codeplex.com) - this package contains "sidewinder.exe" - this exe will download a nuget package from any nuget feed (official, myget, custom) and then unpack the contents of the package and copy the files to whatever folder you select. So if your CI process created a new package version of your test assemblies, sidewinder.exe, once installed on your testers machines will be able to detect the new version, download, unpack and deploy it. You could even include a batch file in the package that ran the correct commandline to launch the gui or console runner.

And for bonus points there is an automated version of this - wolfpack (http://wolfpack.codeplex.com) has a plugin (http://wolfpackcontrib.codeplex.com/wikipage?title=Wolfpack.Contrib.Deployment) that can monitor a nuget feed for new versions of a specific package and automatically download, unpack and run the nunit tests for you - it will create notifications based on the test results.

HTH

Upvotes: 2

Related Questions