【问题标题】:Using allure with xUnit使用 xUnit 的魅力
【发布时间】:2015-06-25 07:42:19
【问题描述】:

是否有人尝试将 Allure 报告用于 xUnit 测试解决方案?我很怀疑,因为支持的适配器列表中没有 xUnit (https://github.com/allure-framework/allure-core/wiki#gathering-information-about-tests)。我已经安装了 Allure teamcity 插件,但工件中没有任何 allure 输出。如果有人将 Allure teamcity 插件与 xUnit 一起使用,请说明如何设置它。提前致谢。

【问题讨论】:

  • 请发布您的“更新”作为答案,并使用“编辑”链接将其从您的问题中编辑出来。
  • 如果您将其作为答案发布,您可以接受自己的答案来关闭此问题

标签: teamcity xunit xunit.net allure


【解决方案1】:

Allure 支持确认目前没有 xUnit 支持。所以唯一的方法是为 xUnit 创建自定义适配器

【讨论】:

    【解决方案2】:

    Allure2 确实支持 xunit 项目。它不需要适配器,但您可以简单地从 xunit xml 报告生成魅力报告。 .netcore2 xunit 测试项目采取的步骤。

    1. 使用命令生成输出 xunit xml 报告:dotnet test --logger:trx
    2. 使用命令生成 Allure 报告: 诱惑服务/home/path/to/project/target/surefire-reports/ (参考文档安装 allure 命令行 - docs.qameta.io/allure/latest/#_installing_a_commandline)

    【讨论】:

      【解决方案3】:

      要在魅力报告中显示 .NET Core 上的 xUnit 测试,您可以使用此 Open Source library。 这是自定义适配器。这个库基于 Allure.Commons。 这是一个使用这个库的带有示例的项目:https://github.com/TinkoffCreditSystems/Allure.XUnit/tree/master/src/Examples

      您必须通过此库属性标记您的测试方法。取而代之的是[Fact()] 属性,您必须使用[AllureXUnit()] 属性,并且您可以使用其他不需要的属性来标记html-report。所有存在的属性都在库 Readme 中进行了描述。

      你必须通过命令运行测试:

      dotnet test <PathToYourProject>
      

      之后,json 文件将在您在allureConfig.json 的“目录”字段中指定的目录中生成。您可以通过命令allure serve 或通过 TeamCity 中的 allure 插件从这个 json 文件构建 html 报告。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-12-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多