jeudi 17 septembre 2020

.Net Core XUnit - No test source files were specified using "dotnet test"

I understand this might sound a minor issue, but hear me out.

I have .net core project with xUnit.

I can run xUnitin visual studio in my development environment.

I can also run tests in console dotnet test Test.dll. (after publish)

But I have another machine(build machine), where I take my published code and try to run "dotnet test", and it throws

No test source files were specified.

This is my test.csproj file, I have installed every recommended packages(I think so).

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="coverlet.msbuild" Version="2.9.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="FluentAssertions" Version="5.10.3" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.3" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
    <PackageReference Include="Respawn" Version="3.3.0" />
    <PackageReference Include="xunit" Version="2.4.0" />
    <PackageReference Include="xunit.runner.console" Version="2.4.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="xunit.runner.msbuild" Version="2.4.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
    <PackageReference Include="coverlet.collector" Version="1.2.0" />
  </ItemGroup>
</Project>

Apart from this, I have .Net Core 3.1 sdk installed on my build machine.

With all this done, shouldn't dotnet test identify testcases?

Is there anything else I need to do?

PS: If you can't answer and think question is clear enough, please upvote.

Aucun commentaire:

Enregistrer un commentaire