mardi 1 décembre 2015

Retrieving test duration from NUnit TestContext

I would like to be able to access the duration of a test in my test code. I have been looking at the TestContext class in NUnit, but while I find information abut "FullName", I cannot figure out where to access the duration of a test.

[TearDown]
public void TearDown()
{
    Console.WriteLine(TestContext.CurrentContext.Test.FullName); 
}

Apart from the full name of the test, I can access a Properties dictionary, but in all cases, only value is a "_CATEGORIES" entry.

How do I accomplish what I want to do?

Thanks :-)

Aucun commentaire:

Enregistrer un commentaire