using NUnit.Framework;
using System;
namespace NUnitTest
{
[SetUpFixture]
public class GlobalSetup
{
static int test = 0;
[SetUp]
public void ImportConfigurationData ()
{
test++;
Console.WriteLine (test);
}
}
}
如果我与这个全局设置函数一起重复运行我的测试(使用标准的NUnit GUI runner),打印的数字每次都会增加一。换句话说,这个函数在每个测试会话中运行多次。
是否有另一种方法可以让每个测试会话真正运行一次函数,或者这是运行器中的错误?