0

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.

Community
  • 1
  • 1
Rafael Fernandes
  • 505
  • 6
  • 10

2 Answers2

4

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/

Richard Fennell
  • 160
  • 1
  • 12
  • When you say, 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, where do I add this nUnity Activity? Wherer is this effect the command line test runner? Thanks for you assistance. – Rafael Fernandes Mar 07 '14 at 18:31
  • I mean, which tool in the Toolbox should I add to run the unit tests after the Find files containing Nunit ? – Rafael Fernandes Mar 07 '14 at 18:33
  • I see the problem, you need to get the nunit activity into you tool box. This is mentioned at the start of the post and a link provided, but it is not that clear. You need to follow the process detailed in this post http://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20extensions%20into%20a%20build%20template&referringTitle=Documentation In the 'to be done once' section. The whole using custom activities is not that nice, but the post tells the full story. – Richard Fennell Mar 07 '14 at 19:48
  • 1
    If you have not read it also look at the alm rangers build guidance as it explains the whole process http://vsarbuildguide.codeplex.com/ – Richard Fennell Mar 07 '14 at 19:54
  • Hey Richard, thanks for the help. I'm going to dig more about it. – Rafael Fernandes Mar 07 '14 at 20:10
0

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

Community
  • 1
  • 1
Rafael Fernandes
  • 505
  • 6
  • 10