Skip to content

dotnet test on multi-project solution retains only last project in the log #3026

@gkalnytskyi

Description

@gkalnytskyi

Description

When I run dotnet test command on the solution that contains multiple test projects and use trx (or other logger) the test log file contains only data from the last test project that was run.

This issue is similar to the one described in #1603 , but it is for multiple projects within a solution instead of multiple targets.

Steps to reproduce

  1. Have a solution that has more than one test projects (NUnit test projects in my case).
  2. Run the following test command

dotnet test <PathToSolutionFile> --test-adapter-path:. --logger:"trx;LogFileName=Regression.trx" --results-directory "<PathToResultsDirectory>"

Command I'm running:
dotnet test <PathToSolutionFile> --test-adapter-path:. --logger:"junit;LogFileName=Regression.xml" --logger:"trx;LogFileName=Regression.trx" --logger:"console;verbosity=normal" --results-directory ".\test-result"

Example repository:
https://github.com/gkalnytskyi/MultiTestSolutionExample

Command for example repository:
dotnet test .\MultiTestSolutionExample.sln --test-adapter-path:. --logger:"trx;LogFileName=Regression.trx" --results-directory ".\test-results"

Expected behavior

I expect that results will be collated into a single trx log file arranged by namespace as with the case of single project with multiple TestFixtures.

Actual behavior

Projects in the solution are executed, but log file Regression.trx contains only test results from the last project executed.

Diagnostic logs

Environment

Relevant subset of package references for all test projects:

<ItemGroup>
    <PackageReference Include="FluentAssertions" Version="5.10.3" />
    <PackageReference Include="JunitXml.TestLogger" Version="3.0.98" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
    <PackageReference Include="NUnit" Version="3.13.2" />
    <PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>

Operating system: Windows 10 Enterprise 10.0.17134
Solution target: netcoreapp3.1
Dotnet Core: 5.0.301
Microsoft.NET.Test.Sdk: 16.11.0
VSTest.Console.exe: 16.10.0


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions