Retrieve Results from NUnit Programmatically

ぐ巨炮叔叔 提交于 2019-12-24 10:42:20

问题


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?


回答1:


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
}


来源:https://stackoverflow.com/questions/20852827/retrieve-results-from-nunit-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!