简体   繁体   English

NUnit在运行会话期间以编程方式获取结果

[英]NUnit get results programmatically during run session

again i am trying to do something and not sure if it is possible. 我再次尝试做某事,不确定是否可能。 i want to run my Nunit tests and after each test is run, i want to output the result to my ui. 我想运行我的Nunit测试,在运行每个测试之后,我想将结果输出到我的ui。 the ui is custom and is used by my test team to run and see test results. ui是自定义的,我的测试团队使用它来运行和查看测试结果。 when i say it is used, it is not developed yet (fully) :) - bringing me to this question. 当我说使用它时,它还没有被开发(完全):)-带我到这个问题。

my code so far 到目前为止我的代码

TestPackage package = new TestPackage(path);
RemoteTestRunner remote = new RemoteTestRunner();
remote.Load(package);
TestResult result = remote.Run(new NullListener(), TestFilter.Empty, true, LoggingThreshold.All);

while (remote.Running)
{
    // want to capture results here
    if (result.HasResults)
        // i can never get here while test is running
}

How about dumping the results as XML into shared location. 如何将结果作为XML转储到共享位置。 And then your UI can parse/pick up from that location 然后您的UI可以从该位置解析/提取

Also try to use common XML schema so that you can easily serialize/deserialize back from XML to C# object and vice versa 还要尝试使用通用的XML模式,以便您可以轻松地从XML序列化/反序列化回C#对象,反之亦然

We have done smth similar in the past and above scenario has worked quite well 我们在过去做过类似的事情,并且上述情况效果很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM