xunit / visualstudio.xunit

VSTest runner for xUnit.net (for Visual Studio Test Explorer and dotnet test)
https://xunit.net/
Other
144 stars 81 forks source link

Segregate xunit.runner.visualstudio.dotnetcore.testadapter.dll #377

Closed ByteMe666 closed 1 year ago

ByteMe666 commented 1 year ago

Hi,

I am using Azure DevOps, and it is documented that xunit.runner.visualstudio.dotnetcore.testadapter.dll should be excluded from being considered a test assembly.

Unfortunately when using Release Pipelines in Azure DevOps and choosing to associate the xUnit tests with Test Cases from a Test Plan as per this documentation, no menu is available and *test*.dll is used by default.

I was hoping to remedy the issue by moving all my actual test assemblies to their own folder and telling Azure DevOps to look for them there. I could do that manually with a BASH of BATCH script in the build pipeline I guess, but I was hoping to do it the "clean" way by configuring properly my .csproj file in the first place.

However it is really short:

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

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>

    <IsPackable>false</IsPackable>
    <IsTestProject>true</IsTestProject>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
    <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>

</Project>

I found some documentation online which reference things that seem useful to specify how I'd like to structure where my .dll files are dropped after they've been built, but my .csproj file looks very short and I have no idea where/how it is defined that all the test assemblies are put together with xunit.runner.visualstudio.dotnetcore.testadapter.dll.

Could someone help me understand where I have to fix these things ?

Thank you very much.

bradwilson commented 1 year ago

Dup of xunit/xunit#2725.