如何为 Xunit.net 项目生成 Allure2 报告

Meg*_*gha 3 report xunit.net allure asp.net-core-2.0

Allure2支持xunit项目吗?我在 Allure2 文档中没有找到它https://docs.qameta.io/allure/2.0/但是是否有一些适配器来实现它?

Meg*_*gha 6

Allure2确实支持xunit项目。它不需要特殊的适配器。Allure2 有内置插件trx-plugin 和 xunit-xml-plugin。使用 allure-commandline 对 .netcore2 xunit 测试项目采取的步骤。

参考文档安装 allure 命令行

Mac OS X brew install allure

窗户 scoop install allure

Linux 为基于 debian 的存储库提供了 PPA

sudo apt-add-repository ppa:qameta/allure
sudo apt-get update
sudo apt-get install allure
Run Code Online (Sandbox Code Playgroud)

TRX报告

  1. 使用命令生成输出 xunit trx 报告:dotnet test --logger:trx
  2. 使用命令生成 Allure 报告:allure serve /home/path/to/project/target/surefire-reports/

XML报告

  1. 在测试项目中添加对Xunit Logger nuget 包的引用。

  2. 使用命令生成输出 xunit xml 报告:dotnet test --logger:xunit

  3. 使用命令生成 Allure 报告: allureserve /home/path/to/project/target/surefire-reports/