简体   繁体   中英

How to determine which nunit tests to run or ignore while building in build server

I want to specify a subset of my test to run while a project builds in build server an so its integrated tests run.

I've found a solution for MSTest tests here: Ignore test categories in TFS build server using DefaultTemplate.xaml

but it doesn't work for Nunit.

I've found Category attribute for Nunit but setting this in the build template doesn't work:

Category=IntegrationTest

while I marked my tests like:

[Category("IntegrationTest")]
[TestFixture]
public MyTestClass ...

You can create custom category (inherit Category class) then in your build script you can ignore this category

This is a example for psake + mstest but it could be easily applied to NUnit and whatever build system are you using

http://log.ld.si/post/longrunningtests-as-a-separate-psake-task

Why do you have them in the same project? I would recommend separating the integration tests to a separate assembly. Since they are different "things" they "should" be separated!

We have had the same problems and i came up with this Solution. Place your UnitTests in one (or more) Projects and your IntegrationTests in another Project (or more than one). The clue is to identify that its UnitTest or IntegrationTest by the project name. For example we named all our UnitTest Projects "UnitTest" besides other specific description.

Then in your builddefinition you can describe the filter which dlls the buildserver should use to load unittests and only load dlls which contain of UnitTest in the filename.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM