Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gkalnytskyi opened this issue Sep 1, 2021 · 2 comments
Closed

Comments

@gkalnytskyi
Copy link

gkalnytskyi commented Sep 1, 2021

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


@Haplois Haplois added the needs-triage This item should be discussed in the next triage meeting. label Sep 1, 2021
@GDreyV
Copy link

GDreyV commented Nov 13, 2021

It looks like you need to use logFilePrefix instead. Check this thread #1951 and code here https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs#L499

@Evangelink
Copy link
Member

I confirm that either replacing LogFileName with LogFilePrefix or removing the --results-directory fixes the issue.

@Evangelink Evangelink removed the needs-triage This item should be discussed in the next triage meeting. label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants