I am having a hard time telling Visual Studio Online to ignore certain tests I do not want to run during VSO build. I have one set of tests in my test library I do not want them to run during the online build process. Those tests might will take an extremelly long time to complete, so I do not want them to be part of the tests that will execute during the build phase, so the build agent takes as few minutes as possible to complete the build. So, I can mark those test with an NUnit category like this
/// <summary>
/// This is a long running test
/// </summary>
[Test]
[Category("LongRunningTest")]
public void ObtainsTourInformationTest() {
...
}
This is a partial capture of my test task definition. I read somewhere I could use the Test filter criteria for this purpose but I haven't figure it out.
I am using the following NUnit packages
<package id="NUnit.Runners" version="2.6.4" />
<package id="NUnit" version="2.6.4"/>
<package id="NUnitTestAdapter" version="2.0.0" />
So, basically, what I need to know is how to tel Visual Studio Online Test Task to ignore tests marked with NUnit Category Attribute.
"TestCategory!=LongRunningTest"
Alternatively, if working online in Visual Studio, group the tests by Traits and select only those you want to run.
The other way to approach this is to put all the long running tests in a separate project and then either:
Here's a screen grab of how we have that set up in Azure DevOps:
We find this particularly effective for end-to-end tests that hit the local DB and so don't work on DevOps. Putting them in their own project is ideal in that scenario as the end-to-end test project can have a connection string to the test database, whereas not having that connection in any of the unit test projects ensures they aren't accidentally hitting the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With