【问题标题】:Create NUnit test cases automatically from Pex从 Pex 自动创建 NUnit 测试用例
【发布时间】:2011-05-05 11:59:13
【问题描述】:

我需要从我的 .Net 解决方案文件中自动创建 NUnit 测试用例。 Morover 这需要从命令行完成。 我听说 Pex 会自动创建测试用例。 告诉你

【问题讨论】:

    标签: command-line nunit pex


    【解决方案1】:

    以下步骤应该可以帮助您:

    1. 在您的测试项目中添加对 Pex.NUnit.dll 的引用
    2. 在您的测试项目的 AssemblyInfo.cs 中,添加属性 - [assembly: Pex.NUnit.PexNUnitPackage]
    3. 构建您的解决方案(从 Visual Studio 或从命令行使用 msbuild)
    4. 从命令行运行 Pex:pex.exe bin\Debug\TestProjectName.dll
    5. 测试放在reports\TestProjecName.#####.#####\tests下。

    您可以在Parameterized Unit Testing with Microsoft Pex 的练习 5 中了解更多信息

    【讨论】:

      【解决方案2】:

      Ryan Gross' 回答 指向正确的方向。

      但是,Pex.exe 从 Parameterized Unit Tests 生成 Unit Tests,而不是从 应用程序类本身。

      要生成Parameterized Unit Tests,您需要运行pexwizard.exe

      pexwizard.exe <your assembly name> options
      

      可能的选项在 http://testoriented.googlecode.com/svn-history/r89/suitability/trunk/Tools/Pex-0.22.50128.1/pexwizard.txt

      【讨论】:

        猜你喜欢
        • 2015-07-26
        • 2018-06-24
        • 2010-10-26
        • 1970-01-01
        • 1970-01-01
        • 2014-10-07
        • 1970-01-01
        • 1970-01-01
        • 2011-01-03
        相关资源
        最近更新 更多