Not picking up xUnit tests

kristian's Avatar

kristian

01 Feb, 2019 08:59 AM

All projects are built successfully, but AppVeyor is unable to find the tests automatically:

Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
  SpaFallback -> C:\projects\middleware\src\SpaFallback\bin\Release\netstandard2.0\Hellang.Middleware.SpaFallback.dll
  SpaFallback.Tests -> C:\projects\middleware\test\SpaFallback.Tests\bin\Release\netcoreapp2.2\Hellang.Middleware.SpaFallback.Tests.dll
  Authentication.JwtBearer.Google -> C:\projects\middleware\src\Authentication.JwtBearer.Google\bin\Release\netstandard2.0\Hellang.Authentication.JwtBearer.Google.dll
  ProblemDetails -> C:\projects\middleware\src\ProblemDetails\bin\Release\netstandard2.0\Hellang.Middleware.ProblemDetails.dll
  ProblemDetails.Tests -> C:\projects\middleware\test\ProblemDetails.Tests\bin\Release\netcoreapp2.2\Hellang.Middleware.ProblemDetails.Tests.dll
  ProblemDetails.Sample -> C:\projects\middleware\samples\ProblemDetails.Sample\bin\Release\netcoreapp2.1\Hellang.Middleware.ProblemDetails.Sample.dll
  RateLimiting -> C:\projects\middleware\src\RateLimiting\bin\Release\netstandard2.0\Hellang.Middleware.RateLimiting.dll
  RateLimiting.Tests -> C:\projects\middleware\test\RateLimiting.Tests\bin\Release\netcoreapp2.2\Hellang.Middleware.RateLimiting.Tests.dll
Discovering tests...OK
Build success

The test projects don't directly reference xunit as all the test dependencies are part of a Directory.Build.props file further up in the directory hierarchy:

<Project>
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <IsPackable>False</IsPackable>
    <LangVersion>Latest</LangVersion>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
  </ItemGroup>
</Project>

The test projects themselves are prettey simple:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AssemblyName>Hellang.Middleware.ProblemDetails.Tests</AssemblyName>
    <RootNamespace>Hellang.Middleware.ProblemDetails.Tests</RootNamespace>
  </PropertyGroup>
  
  <ItemGroup>
    <ProjectReference Include="..\..\src\ProblemDetails\ProblemDetails.csproj" />
  </ItemGroup>
</Project>

Is this not a supported scenario? Do I have to copy over the dependencies into each project file for AppVeyor to detect unit test projects?

  1. Support Staff 1 Posted by Ilya Finkelshte... on 01 Feb, 2019 08:14 PM

    Ilya Finkelshteyn's Avatar

    Yeah, right now we are looking for direct references in project files. Please watch https://github.com/appveyor/ci/issues/2816 for the fix. For now you can add references just to make AppVeyor recognize test projects or (clear approach), use test script mode and call dotnet test with appropriate switches.

  2. Ilya Finkelshteyn closed this discussion on 03 Apr, 2019 09:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

22 Aug, 2019 08:13 PM
21 Aug, 2019 11:06 PM
21 Aug, 2019 02:08 PM
21 Aug, 2019 01:37 PM
21 Aug, 2019 10:21 AM
21 Aug, 2019 05:56 AM