Siddhant
Siddhant

Reputation: 581

Retrieve Results from NUnit Programmatically

Is it possible to retrieve the results of the Unit tests run using NUnit programmatically? If Yes then How? I have read that we can generate XML file using Nunit Console. Is there any other way around apart from generating and then parsing XML?

Upvotes: 1

Views: 1231

Answers (1)

Sergey Berezovskiy
Sergey Berezovskiy

Reputation: 236308

Yes, it is possible. You can use current test context to get name of test, status, working directory, etc

[TearDown]
public void TearDown()
{
    var context = TestContext.CurrentContext;
    // context.Test.Name
    // context.Result.Status
}

Upvotes: 3

Related Questions