0
votes

I need to run nUnit tests using a workflow template in TFS Server 2010.

TFS Build Workflow

I found all the reference bellow explaning how to configure the Build server:

Bellow is closest to what I need:

But the answer I need is for the question bellow:

"How to set a variable containing all the nUnit tests and how to configure a for each loop to run all the tests"

I do get all my build to run, but in the end, it does not run any nUnit test.

But which tool should I use to run the nUnit tests?:

enter image description here

Please let me know if you have any advice on how to get it done using the TFS 2010.

Thank you so much.

2

2 Answers

4
votes

The post •https://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20nUnit%20build%20activity gives all the steps required to make use of this community TFS extensions. It is meant to be a step by step to get the activity working

Step 1 of the notes shows how to find all the assemblies that have been built, basically scan a for any file ending *.dll. I think this is the key to your question, you just pass a list of all DLLs produced by the build and let nUnit find the tests. If you want to do something else you can build the list of DLLs any way you want, but a scan seems the most simple, you don't have to worry over managing the list ypourself

Step 2a runs the nUnit test, the list of DLLs is passed into the nUnit activity (in effect the command line test runner). This will look in each DLL for the nUnit attributes and run the tests it finds.

Step 2b publishes the results back to TFS. This is done by taking the XML output of the test runer and publishing it with MSTEST to the TFS server.

If you are using TFS 2012 or later I would not use this activity, I would use the new test adaptor model built into TFS http://blogs.blackmarble.co.uk/blogs/rfennell/post/2012/03/27/Unit-testing-in-VS11Beta-and-getting-your-tests-to-run-on-the-new-TFSPreview-build-service.aspx and http://visualstudiogallery.msdn.microsoft.com/c8164c71-0836-4471-80ce-633383031099/

0
votes

I was missing two steps answered in the link bellow:

Visual Studio Online CI Nunit Tests not found during build

1 - To add the nUnit adapter on each test project

2 - To add the nUnit 4.5 dlls to the build server and check it in