Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 from cmd, I get the XML file with results. What should I do to obtain the same result if run tests from Visual Studio?

like image 881
Farfi Avatar asked Aug 03 '15 11:08

Farfi


1 Answers

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.

like image 150
Maxime Rouiller Avatar answered Sep 30 '22 16:09

Maxime Rouiller