How can I ignore NUnit tests of a certain category while doing a Jenkins build? I know how to do this in Team City. Our production environment uses Jenkins whilst our developers use Team City. I need some tests (database integration) to be ignored while doing our production build on Jenkins. Any links, tips, or code are certainly appreciated.
[Test, Category("DBExclude")]
public void WidgetRepository_FindById_ReturnsWidget()
{
//I should not run on Jenkins
}
Thanks All!
If you are using a Windows Batch command to execute the NUnit tests as part of the Jenkins job, you may simply use the command-line option "/exclude" on the category you've assigned to the test. For the example you've given, the command would be something akin to...
nunit-console /exclude:DBExclude nunit.tests.dll
And, just for the record, you can do it the other way and select to run tests WITH a certain category as opposed to only those WITHOUT by using the following (again, making use of your example):
nunit-console /include:DBExclude nunit.tests.dll
NUnit has documentation that details these options and more here: NUnit Documentation
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