【问题标题】:What's a good way to debug unit tests written with multiple [Row] attributes?调试使用多个 [Row] 属性编写的单元测试的好方法是什么?
【发布时间】:2010-09-26 08:10:27
【问题描述】:

当我在 Gallio 的 Icarus 中运行以下测试时,它通过了,但是当我使用 TestDriven.NET(Test With->Debugger)进入它时,它失败了,因为没有根据 Row 属性设置参数。

我希望为每个应用的 Row 属性调用一次该方法。

我做错了什么?如果没有,那么当它们中断时我需要做什么来调试这些测试?如果参数化测试不可调试,我应该避免它们吗?

[TestFixture]
public class TestDrivenIgnoresMbUnitAttributesWhenDebugging
{
    [Test]
    [Row(1)]
    [Row(2)]
    public void SomeFunc(int x)
    {
        Assert.AreNotEqual(default(int), x);
    }
}

【问题讨论】:

    标签: c# debugging tdd mbunit


    【解决方案1】:

    嗯...您在安装 Gallio 之前安装了 TestDriven.Net 吗?

    如果没有,则不会安装 TestDriven.Net 的 Gallio 扩展。在这种情况下,TestDriven.Net 可能会在“ad-hoc”模式下使用其参​​数的默认值运行测试。

    应该很好判断是否是这种情况。如果安装了 TestDriven.Net 的 Gallio 扩展,那么您将在测试执行期间在输出窗口中看到“Gallio”横幅消息。如果不是,您可能会看到类似“ad-hoc”的其他内容。

    要解决此问题,请重新安装 Gallio。或者,您可以使用 Gallio 安装程序的添加/删除功能部分,然后确保选择了 TestDriven.Net 组件进行安装(在“Test Runners”下)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      相关资源
      最近更新 更多