【问题标题】:what is the equivalent test attribute for TestFixtureSetUp of Nunit in MSTestMSTest 中 Nunit 的 TestFixtureSetUp 的等效测试属性是什么
【发布时间】:2011-03-25 13:15:17
【问题描述】:

在 NUnit 中我们使用 TestFixtureSetUp MSTest 中的等效测试是什么?

谢谢

【问题讨论】:

    标签: mstest


    【解决方案1】:

    在这里您可以找到并排显示 NUnit 和 MSTest 属性的好表:

    https://www.lambdatest.com/blog/nunit-vs-xunit-vs-mstest/

    你的答案是ClassInitialize 属性

    【讨论】:

    • 链接已失效。
    【解决方案2】:

    您正在寻找[ClassInitialize] attribute

    [ClassInitialize]
    public static void Initialize(TestContext testContext) { ... } 
    

    【讨论】:

    • hmm...但是这个方法必须是静态的...这意味着它不能用于初始化类实例变量...或者我错过了什么。
    • @EoinCampbell:你可以使用构造函数。
    猜你喜欢
    • 2011-01-22
    • 2011-02-19
    • 2010-11-03
    • 2014-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-29
    • 2023-03-14
    相关资源
    最近更新 更多