I'm using MSTEST. I wish to tag test methods with the [TestWithCheats] attribute. These tests should be skipped without failing if they are run in the RELEASE configuration. However, they must be executed when in DEBUG configuration.
I tried using Assert.Inconclusive in test method, but it always throw an exception.
public static class TestHelpers
{
public static void SkipIfCheatsNotAllowed()
{
#if !ALLOW_CHEATS
Assert.Inconclusive("Skipping cheat tests in Release mode.");
#endif
}
}
TestHelpers.SkipIfCheatsNotAllowed();
So the main problem is these tests failed in jenkins.
Failed TriggerFreeSpinsRejectCashout [2 ms]
Error Message: Assert.Inconclusive failed.
Skipping cheat test in Release configuration.
Here's the approach I usually take in these situations:
[TestCategory("SkipInOfficialBuild")]
public static void SkipIfCheatsNotAllowed()
{
...
}
dotnet test
it should look something like this:dotnet test --filter TestCategory!=SkipInOfficialBuild