gpt4 book ai didi

c# - SetUp 方法在扩展的 TestFixture 类中的行为如何?

转载 作者:太空宇宙 更新时间:2023-11-03 23:05:02 26 4
gpt4 key购买 nike

我有两个测试类,如本例所示:

[TestFixture]
class BaseTest {

[SetUp]
public void SetupMethodA() {

}

}

[TestFixture]
class SomeTestFixture : BaseTest {

[SetUp]
public void SetupMethodB() {

}

}

在(SetupMethodASetupMethodB)中调用两个 SetUp 方法是否有定义的顺序?

最佳答案

根据latest NUnit documentation :

if a base class has defined a SetUp method, that method will be called before each test method in the derived class.

NUnit will call base class SetUp methods before those in the derived classes.

关于c# - SetUp 方法在扩展的 TestFixture 类中的行为如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41611937/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com