加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何使用XUnit控制台输出NUnit格式的xml?

发布时间:2020-12-16 07:47:43 所属栏目:百科 来源:网络整理
导读:我需要XUnit测试的NUnit输出报告.使用NUnit我可以做到: nunit-console.exe /xml=c:TestResultN.xml MyDll.dll 我试过了: xunit.console MyDll.dll /nunit TestResults.xml 但我得到: unknown output transform: nunit 在xunit控制台上有什么好的文档吗?
我需要XUnit测试的NUnit输出报告.使用NUnit我可以做到:
nunit-console.exe /xml=c:TestResultN.xml MyDll.dll

我试过了:

xunit.console MyDll.dll /nunit TestResults.xml

但我得到:

unknown output transform: nunit

在xunit控制台上有什么好的文档吗?我找不到任何信息.

输入xunit.console.exe /?在控制台中查看选项列表的末尾.
> xunit.console.exe /?
xUnit.net console test runner (64-bit .NET 2.0.50727.4952)
Copyright (C) 2007-10 Microsoft Corporation.

usage: xunit.console <xunitProjectFile> [options]
usage: xunit.console <assemblyFile> [configFile] [options]

Valid options:
  /silent                : do not output running test count
  /teamcity              : forces TeamCity mode (normally auto-detected)
  /wait                  : wait for input after completion

Valid options for assemblies only:
  /noshadow              : do not shadow copy assemblies
  /xml <filename>        : output results to Xunit-style XML file
  /html <filename>       : output results to HTML file
  /nunit <filename>      : output results to NUnit-style XML file

最后两个选项是从配置文件中提取的,由一个应用于xunit输出的xslt文件组成.如果/ nunit不存在,请确保在xunit目录中有NUnitXml.xslt文件,并且在xunit.console.exe.config文件中声明了条目nunit.

我的xunit.console.exe.config文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
    <section name="xunit" type="Xunit.ConsoleClient.XunitConsoleConfigurationSection,xunit.console"/>
  </configSections>

  <xunit>
    <transforms>
      <add
        commandline="html"
        xslfile="HTML.xslt"
        description="output results to HTML file"/>
      <add
        commandline="nunit"
        xslfile="NUnitXml.xslt"
        description="output results to NUnit-style XML file"/>
    </transforms>
  </xunit>

</configuration>

如果您无法找到这些文件,则可能需要重新安装xunit.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读