Search code examples
xunitvisual-studio-2022

XUnit tests not executed anymore with Visual Studio 17.4.0


Since upgrade to Visual Studio 2022 17.4.0, xunit tests are correctly displayed in test explorer, but they are not executed. They were correctly executed in previous versions. There is no error message.

We have "Tests in the group : 11". Results : 11 not executed.

Build is ok.

I'm using framework.net 4.8

Here is my project references

 <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
    <PackageReference Include="Moq" Version="4.18.2" />
    <PackageReference Include="xunit" Version="2.4.2" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="3.2.0">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>

Thanks.

Upgrading to VS Version 17.4.0.1 does not fix the problem. upgrading to Framework 4.8.1 neither. upgrading to latest version of xunit neither. Restarting, clearing and rebuild neither. Changing target processor to x64 or x86 or auto neither.


Solution

  • The workaround is to downgrade Xunit package to xunit.runner.visualstudio 2.4.1 (last version is 2.4.5). I also downgraded Xunit to 2.4.1. Then I restarted the solution and the tests are running. Thanks Jérôme P. for the trick.