简体   繁体   中英

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. the ui is custom and is used by my test team to run and see test results. 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. And then your UI can parse/pick up from that location

Also try to use common XML schema so that you can easily serialize/deserialize back from XML to C# object and vice versa

We have done smth similar in the past and above scenario has worked quite well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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