加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c#-4.0 – Nunit 2.6.2 Suite运行两次而不是一次

发布时间:2020-12-15 21:43:58 所属栏目:百科 来源:网络整理
导读:using System;using System.Collections;using NUnit.Framework;namespace Tests.MyTest{public class SpikeSuite{ [Suite] public static IEnumerable Suite { get { var suite = new ArrayList { new SpikeTest(),}; return suite; } }}[TestFixture]publi
using System;
using System.Collections;
using NUnit.Framework;

namespace Tests.MyTest
{
public class SpikeSuite
{
    [Suite]
    public static IEnumerable Suite
    {
        get
        {
            var suite = new ArrayList
                {
                    new SpikeTest(),};
            return suite;
        }
    }
}

[TestFixture]
public class SpikeTest
{
    [SetUp]
    public void Setup()
    {
        Console.WriteLine("Test setup");
    }

    [TestFixtureSetUp]
    public void FixtureSetup()
    {
        Console.WriteLine("Test fixture setup");
    }

    [Test]
    public void TestMethod()
    {
        Console.WriteLine("Test method");
    }
}

}

当我运行上面提到的灯具时,我得到的输出是:

测试夹具设置

.测试设置

测试方法

测试夹具设置

.测试设置

测试方法

如何将测试设置,夹具设置和测试方法执行两次?

解决方法

检查您的测试项目是否未被其他测试项目引用.在这种情况下,它将出现在两个bin文件夹中并运行两次.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读