从 Nunit 获取失败测试列表
问题说明
我有一个包含 8000 多个测试的测试套件,并且很难看到哪些测试在代码更改之间中断(这些测试用例是从某些日志文件中自动提取的查询).
I have a testsuite with over 8000 tests and it's getting really hard seeing which tests broke between code changes (these test cases are queries that were automatically extracted from some log files).
是否有一种简单的方法可以获取 NUnit 运行的失败测试列表?理想情况下,我想比较哪些测试在运行之间受到影响.
Is there a simple way to get the list of failing tests for a NUnit run? Ideally, I'd like to compare which tests were affected between runs.
正确答案
您可以实现NUnit.Core.Extensibility.IAddin"和NUnit.Core.EventListener".因此,您可以操纵测试结果.NUnit(2.5 或更高版本)将自动加载实现IAddin"方法的类.
You can implement 'NUnit.Core.Extensibility.IAddin' and 'NUnit.Core.EventListener'. So you can manipulate the results of your tests. The NUnit (2.5 or higher) will automatically load your class that implements the methods of "IAddin."
像这样:
using System;
using System.Text;
using NUnit.Core.Extensibility;
using NUnit.Core;
namespace YourNUnitAddIns
{
/// <summary>
/// Coleta informacoes da execucao do NUnit.
/// </summary>
[NUnitAddin(
Name="CollectNUnitFailAddIn",
Description="do something",
Type=ExtensionType.Core)]
public class CollectNUnitFailAddIn : IAddin, EventListener
{
#region IAddin Members
public bool Install(IExtensionHost host)
{
IExtensionPoint suiteBuilders = host.GetExtensionPoint("SuiteBuilders");
IExtensionPoint testBuilders = host.GetExtensionPoint("TestCaseBuilders");
IExtensionPoint events = host.GetExtensionPoint("EventListeners");
if (events == null)
return false;
events.Install(this);
return true;
}
#endregion
#region EventListener Members
public void RunFinished(Exception exception)
{
//do something here.
}
public void RunFinished(TestResult result)
{
//do something here.
}
public void RunStarted(string name, int testCount)
{
//do something here.
}
public void SuiteFinished(TestResult result)
{
//do something here.
}
public void SuiteStarted(TestName testName)
{
//do something here.
}
public void TestFinished(TestResult result)
{
//do something here.
}
public void TestOutput(TestOutput testOutput)
{
//do something here.
}
public void TestStarted(TestName testName)
{
//do something here.
}
public void UnhandledException(Exception exception)
{
//do something here.
}
#endregion
}
}
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcbckei
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20