如何生成specflow nunit testresult.xml

本文关键字:testresult xml nunit specflow 何生成 | 更新日期: 2023-09-27 17:59:47

我已经为Web服务编写了BDD,我必须为此生成报告。因此,请让我知道逐步创建testresult.xml文件

如何生成specflow nunit testresult.xml

查看文档:http://www.specflow.org/documentation/Reporting/

根据中的注释Specflow nunit测试报告为空白

我降级到nunit框架2.6.4,它起作用了:)

使用SpecFlow dotnet5,您可以生成一个trx结果文件,执行:

dotnet test --logger "trx;LogFileName=results.trx"

之后,在全球范围内使用此工具https://github.com/gfoidl/trx2junit

dotnet tool install --global trx2junit --version 2.0.0

将trx文件转换为junit文件

trx2junit results.trx
trx2junit (c) gfoidl -- v2.0.0
https://github.com/gfoidl/trx2junit
Converting 1 trx file(s) to JUnit-xml...
Converting 'results.trx' to 'results.xml'
done in 0.0738152 seconds. bye.

results.xml是使用预期的junit格式生成的。