2

I'd like to be able to set a condition from which to decide whether certain tests run in NUNIT.

For example if a global variable x = 1 then only run the tests from a certain class/assembly or only run the first test.

Is anything like this possible?

How would one go about doing this?

Thanks!!

user259286
  • 977
  • 3
  • 18
  • 38

1 Answers1

3

I would recommend using Categories with your NUnit tests. This would allow you to run groups of them at a time, or all at once.

While Categories seem like the "more pure" way to do this, you could programmatically skip tests like this post asks: Programmatically skip an nunit test. It seems to me, this approach is what you're looking for though.

Community
  • 1
  • 1
Chris Missal
  • 5,987
  • 3
  • 28
  • 46
  • How to run categories in the command line? In the wiki, it's mentioned to use /include or /exclude argument. But how to use it exactly? Any example please? – Mounika May 20 '22 at 08:51