lundi 16 novembre 2015

Is there test status property in NUnit 3.0?

In NUnit v. < 3.0 there was TestContext class and there was a property that could tell us a status of the previously run test.

To access the property we could use TestContext.CurrentContext.Result.Status

Now in NUnit 3.0 there is no property as Result! So all my tests need to be changed.

My question is the next: is it possible to get test status in NUnit 3.0 as it was possible to do in previous version?

Interesting thing: there was class TestStatus with properties: Passed, Failed etc. and we used it to compare with current status. This class is present in NUnit 3.0!

My code:

if (TestContext.CurrentContext.Result.Status == TestStatus.Failed)
{
    //Be happy if it works)
}

Aucun commentaire:

Enregistrer un commentaire