问题描述
每当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 NoSuchElementException
s - test should still fail of course.
推荐答案
你可以写一个记录信息的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测试的其他日志输出失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!