简体   繁体   中英

xunit tests don't save output to xml

I have the following preconditions:

  1. Visual Studio 2015 Community, dnx version 1.0.0-beta5
  2. ASP.NET vNext project
  3. ASP.NET vNext project with unit-tests (further: Unit-test project)
  4. project.json in Unit-test project

     "frameworks": { "dnx451": { "dependencies": { "xunit": "2.1.0-beta3-*", "xunit.runner.dnx": "2.1.0-beta3-*", "xunit.abstractions": "2.0.0", "Moq": "4.2.1507.118", } } }, "commands": { "test": "xunit.runner.dnx -xml TestResults.xml" }, 

When I run tests within Visual Studio, a new file TestResults.xml is created, but it is empty except for :

<?xml version="1.0" encoding="utf-8"?>
<assemblies>
  <assembly />
</assemblies>

When I run the command dnx . test -xml TestResults.xml dnx . test -xml TestResults.xml from cmd, I get the XML file with results. What should I do to obtain the same result if run tests from Visual Studio?

Have you tried changing your commands to this:

{
    "commands": {
        "test": "xunit.runner.dnx"
    }
}

And running your command line like this: dnx test -xml TestResults.xml ? As far as I see it, there's no reason why the command line parameters wouldn't be forwarded to the runner.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM