Как вывести форматированный NUnit xml с помощью консоли XUnit? - PullRequest
7 голосов
/ 13 декабря 2010

Мне нужен вывод NUnit из тестов XUnit для отчета.С NUnit я могу сделать:

nunit-console.exe /xml=c:\TestResultN.xml MyDll.dll

Я пробовал:

xunit.console MyDll.dll /nunit TestResults.xml

, но я получаю:

unknown output transform: nunit

Какие-нибудь хорошие документы на консоли xunit?Я не могу найти информацию.

1 Ответ

20 голосов
/ 17 января 2011

Введите 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

Последние две опции извлекаются из файла конфигурации и состоят из файла xslt, примененного к выходным данным xunit. Если /nunit отсутствует, убедитесь, что у вас есть файл NUnitXml.xslt в каталоге xunit, а запись nunit объявлена ​​в файле xunit.console.exe.config.

Мой 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.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...