Additional log output on NUnit test fail

我们两清 提交于 2020-01-24 18:06:53

问题


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).

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


回答1:


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/.



来源:https://stackoverflow.com/questions/24888492/additional-log-output-on-nunit-test-fail

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