How to exclude test run using VS2012, TFS Build and NUnit

I have the following setup for Visual Studio 2012 Update 2 NUnit Test Beta 4 NUnit 2.62

I mark a test with one of the following Category attributes from NUnit or TestCategory from MSTest:

[Category("WebServer")] public void FooTest() { //test } [TestCategory("WebServer")] public void FooTest2() { //test } 

In the TFS build template, I set the property

  • Basic → 1. Test source → Filter test cases for value: TestCategory! = WebServer

When the assembly performs NO TESTS. Filter removal and all tests run again.

Exit build log

There is no test in C: \ Builds \ 2 \ Proj \ Build \ bin \ Debug \ Tests.Integration.dll C: \ Builds \ 2 \ Proj \ Build \ bin \ Debug \ Tests.Unit.dll C: \ Builds \ 2 \ Proj \ Build \ bin \ Debug \ Tests.Web.dll C: \ Builds \ 2 \ Proj \ Build \ bin \ Debug \ TestStack.BDDfy.dll. Verify that the installed testers and implementers, platform settings, and platform versions are appropriate and try again.

Any hints, how can I get a test to exclude a database by category name? I can easily check if the attribute works if I use a runner for the NUnit console.

+4
source share
3 answers

From here , you will not be able to use TestCategory filters for NUnit tests, only on MSTest tests.

As a note, it will also show that you are changing the property in the TFS assembly definition, and not in the assembly template. This is what I would expect, since changing the assembly definition would be the wrong place to change this.

+2
source

When using NUnit Test Adapter v1.1 +, test categories can be used for TFSBuild. You just need to install the package using the test project and configure the test script filter in the assembly definition.

+3
source

Answering an old question, as this was one of the first results that Google returned.

From here it seemed like it was a bug that was fixed in version 1.1, unfortunately (as of January 22, 2014) it has not yet been released in nuget

+1
source

Source: https://habr.com/ru/post/1482891/


All Articles