gpt4 book ai didi

visual-studio-2017 - 使用 Visual Studio Runner 为 xUnit 生成 XML 报告

转载 作者:行者123 更新时间:2023-12-02 01:07:45 28 4
gpt4 key购买 nike

我只是使用 xUnit 测试设置了一个新项目 (.net 4.6.2)。为了在 VSTS 中进行单元测试,我在项目中添加了visual-studio runner(使用nuget)。

现在我想知道:如何获得我的测试运行的 XML 报告,以便我可以在 VSTS 中发布这些结果?

最佳答案

Xunit logger 可以生成 xunit v2 格式 ( https://xunit.github.io/docs/format-xml-v2.html ) 的 xml 报告。

  • 添加对 Xunit Logger 的引用测试项目中的 nuget 包
  • 在测试中使用以下命令行
    dotnet 测试 --test-adapter-path:。 --logger:xunit
  • 测试结果生成在TestResults目录下相对于test.csproj
    报告文件的路径可以指定如下:
    dotnet 测试 --test-adapter-path:。 --logger:xunit;LogFilePath=loggerFile.xml
    loggerFile.xml 将在与 test.csproj 相同的目录中生成。
  • 关于visual-studio-2017 - 使用 Visual Studio Runner 为 xUnit 生成 XML 报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46788547/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com