NUnit测试的其他日志输出失败 [英] Additional log output on NUnit test fail

查看:145
本文介绍了NUnit测试的其他日志输出失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当NUnit测试在执行期间失败(即不使用 Assert。* )时,我想记录附加信息(I'如何在NUnit中指定一个全局异常处理程序,它能够在网页的当前DOM上记录附加信息。

Whenever an NUnit test fails during its execution (i.e. not when using Assert.*), I want to log additional information (I'm writing web tests and I am especially interested in the web page's current DOM).

code> NoSuchElementException s - 测试仍然会失败。

How to specify a global exception handler in NUnit which is able to log additional information on NoSuchElementExceptions - test should still fail of course.

推荐答案

你可以写一个记录信息的NUnit事件监听器插件。请参阅 http://www.nunit.org/index.php? p = nunitAddins& r = 2.6.3 http ://www.nunit.org/index.php p =事件侦听&安培; R = 2.6.3 ?。有关教程,请参阅 https:// www.simple-talk.com/dotnet/.net-tools/testing-times-ahead-extending-nunit/

You could write an NUnit event listener addin that logs the information. See http://www.nunit.org/index.php?p=nunitAddins&r=2.6.3 and http://www.nunit.org/index.php?p=eventListeners&r=2.6.3. For a tutorial, see https://www.simple-talk.com/dotnet/.net-tools/testing-times-ahead-extending-nunit/.

这篇关于NUnit测试的其他日志输出失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆