Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate NUnit Tests (written in C#) in TFS builds?

I've written tests using Selenium in NUnit Framework using C# language. I want to associate these tests as part of builds in the TFS. So whenever new build is generated. These tests would be able to run as part of builds and generate/email reports as well.

like image 285
Mohsin Awan Avatar asked Nov 10 '16 21:11

Mohsin Awan


People also ask

How is unit testing implemented in C?

Define the function within the unit test file itself, probably at the top of the file. If it is a C function being called by C code, place it within the extern "C" {} section. As a last resort, one can compile out the function calls and implementations using a define for unit tests. e.g. #if !

Can NUnit be used for integration testing?

NUnit is the standard unit test framework for . NET applications. This section describes how to run NUnit tests in TestComplete.

How do I run a NUnit test in C#?

Navigate to Tools -> NuGet Package Manager -> Manager NuGet Packages for Solution. Search for NUnit & NUnit Test Adapter in the Browse tab. Click on Install and press OK to confirm the installation. With this installation, the NUnit framework can be used with C#.


1 Answers

Recommend you to use the new build system vNext build. vNext builds are JSON based, and you can plugin tasks built in msbuild, powershell and varied other scripting languages.

About how to integrate NUnit Tests in TFS builds, this blog describes clearly how to do this: Running NUnit Tests in a TFS 2015 Build vNext

Simply summarized as follows:

  1. Add Nuget Package for NUnit Test Adapter
  2. Specify path of custom Test Adapter inside build definition

    • Copying adapters inside Visual Studio TestWindows folder

    • Specify Path to Custom Test Adapter with nunit packages

Some other tutorial for you reference:

xUnit or NUnit with Visual Studio Online Build

Running nUnit and Jasmine.JS unit tests in TFS/VSO vNext build

like image 156
PatrickLu-MSFT Avatar answered Oct 14 '22 04:10

PatrickLu-MSFT