[英]How to run the same nunit tests with different preconditions? (fixtures)
創建一個參數化的測試夾具。 將有關應使用哪種設置(可能是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
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.