I have a problem where my xUnit tests in my ASP.Net Core 1.0 application are not discovered when building on Visual Studio Team Services.
The test project is being built successfully, but no test results are given. I find the following messages regarding the Visual Studio Test step in the log:
******************************************************************************
Starting task: Test Assemblies **\*test*.dll;-:**\xunit.runner.visualstudio.testadapter.dll
******************************************************************************
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\VSTest\1.0.29\VSTest.ps1
Working folder: C:\a\1
Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\a\1\s\artifacts\bin\project.test\Debug\dnx451\project.test.dll" /EnableCodeCoverage /InIsolation /logger:trx
Microsoft (R) Test Execution Command Line Tool Version 14.0.24720.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Warning: No test is available in C:\a\1\s\artifacts\bin\project.test\Debug\dnx451\project.test.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
Attachments:
C:\a\1\TestResults\0ad44b11-4dd4-41ba-a0bf-66d9cd487a3c\buildguest_TASKAGENT5-0007 2016-03-01 07_33_04.coverage
Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true
No results found to publish.
The tests are written like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Xunit;
namespace project.tests
{
public class ProjectTests
{
[Fact]
public void PassingTest()
{
Assert.Equal(4, Add(2, 2));
}
[Fact]
public void FailingTest()
{
Assert.Equal(5, Add(2, 2));
}
int Add(int x, int y)
{
return x + y;
}
}
}
The tests run just fine locally, but not on Visual Studio Team Services.
For reference, this is my project.json
{
"authors": [ "Tom Reiertsen" ],
"commands": {
"test": "xunit.runner.dnx"
},
"dependencies": {
"project": "1.0.0-rc1-update1",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final",
"Microsoft.AspNet.TestHost": "1.0.0-rc1-final",
"Microsoft.AspNet.WebApi.Client": "5.2.3",
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516",
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-rc1-build204",
"xunit.runner.visualstudio": "2.1.0"
},
"description": "project.test Class Library",
"frameworks": {
"dnx451": { }
},
"licenseUrl": "",
"projectUrl": "",
"tags": [ "" ],
"version": "1.0.0-rc1-update1"
}