4
votes

I try to setup asp.net core 1.0 test using xunit test in Visual Studio Team Services (was Visual Studio Online), no matter i try it not able to find the assemblies.

Project

\src
\test --Folder
\test\Job.Core.Tests -- project name

Visual Studio Test Setting:

Test Assembly: \$(BuildConfiguration)*tests*.dll;-:\obj**
Code Coverage Enabled: true
VSTest version: Visual Studio 2015
Path to Custom Test Adapters: $(Build.SourcesDirectory)\packages
Other console options: /InIsolation
Platform: $(BuildPlatform)
Configuration: $(BuildConfiguration)

may I know where i goes wrong.

2016-04-09T05:27:33.1647258Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\VSTest\1.0.34\VSTest.ps1

2016-04-09T05:27:35.3816395Z ##[warning]No test assemblies found matching the pattern: '\release*test*.dll;-:\obj**'.

2

2 Answers

0
votes

The default templates available on vso-build provides an example of what you want. If you create a new build definition and then select Visual Studio as the default template, you get a Visual Studio Test task which tries to discover all dlls which has 'test' in their name.

The test assembly name should be in this format.

**\$(BuildConfiguration)\*test*.dll;-:**\obj\**

Also make sure that you set the working folder to the proper location so that it can find the dlls using the search pattern mentioned above.

0
votes

I assume you are using a same approach to implement xUnit test in Asp.Net Core project as this link: Getting Started with xUnit.net (DNX / ASP.NET 5).

Generally, the build output directory for Asp.Net Core project is a bit different with other projects. The compiled dlls are placed in $(BuildConfiguration)\dnx451 folder. This depends on the framework you use. To find these files, update the path of Test Assemblies to following:

**\$(BuildConfiguration)\*\*test*.dll;-:**\obj\**