NUnit的:访问失败消息在TearDown中()

编程入门 行业动态 更新时间:2024-10-27 02:19:07
本文介绍了NUnit的:访问失败消息在TearDown中()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图登录的自动化测试的结果NUnit的一个小数据库上运行,这样的数据是方便和更安全地记录各种原因。 (有一个关于〜550自动化测试和运行它们都可能需要数天)

I'm trying to log the results of automated tests run in NUnit in a small database so that data is easily accessible and more securely logged for various reasons. (There's about ~550 automated tests and running them all can take days)

我已经有机会获得测试的结束状态(合格/不合格/错误/取消/跳过等),但我想记录额外的细节。

I already have access to the ending status of the test (Passed/Failed/Error/Cancelled/Skipped etc..) but I'd like to log the extra detail.

我期待在TearDown中()做到这一点。

I am looking to do this within TearDown().

这是我能找到的最接近,但没有提供给我一个答案:的groups.google/forum/?fromgroups=#!msg/nunit-discuss/lXxwECvpqFc/IbKOfQlbJe8J

This is the closest thing I could find, but did not provide me with an answer: groups.google/forum/?fromgroups=#!msg/nunit-discuss/lXxwECvpqFc/IbKOfQlbJe8J

想法?

推荐答案

我相信你能得到你的 NUnit的事件监听器的。我还没有使用这些我自己,但我已经拥有他们喜爱的做类似你要完成的事情。

I believe you'll be able to get the information you need with NUnit EventListeners. I haven't used these myself, but I've had them bookmarked to do something similar to what you're trying to accomplish.

下面是你要使用的接口。希望您的 TearDown中方法将被调用之前 TestFinished 而已,但我无法验证这一点。

Here's the interface you'd be working with. Hopefully your TearDown method would be called just before TestFinished, but I can't verify this.

public interface EventListener { void RunStarted(string name, int testCount ); void RunFinished(TestResult result); void RunFinished(Exception exception); void TestStarted(TestName testName); void TestFinished(TestResult result); void SuiteStarted(TestName testName); void SuiteFinished(TestResult result); void UnhandledException(Exception exception); void TestOutput(TestOutput testOutput); }

更多推荐

NUnit的:访问失败消息在TearDown中()

本文发布于:2023-11-07 15:00:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566760.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:消息   NUnit   TearDown

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!