最佳答案
创建单个参数化测试装置。传递有关应将哪个设置(可能是 OneTimeSetUp)应用于夹具的每个实例的信息。该信息必须是字符串等常量值,以便可以用作属性的参数。
例如...
[TestFixture("setup1", 5)]
[TestFixture("setup2", 9)]
public class MyTestFixture
{
public MyTestFixture(string setup, int counter)
{
// You can save the arguments, or do something
// with them and save the result in instance members
}
[Test]
public void SomeTest()
{
// Do what you need to do, using the arguments
}
}
关于c# - 如何在不同的前提条件下运行相同的 nunit 测试? (赛程),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39529699/