Vstest: dotnet test on a multi-target projects logs only the last target

Created on 17 May 2018  路  7Comments  路  Source: microsoft/vstest

Description

dotnet test "--logger:trx;LogFileName=results.trx" on a multi-target project (e.g. <TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks> in the .csproj) causes the logger to only log the last target. Possibly because the previous targets' logger output file is overwritten by subsequent targets. FYI, this also happens with the nunit logger extension.

Steps to reproduce

dotnet test "--logger:trx;LogFileName=results.trx"

Expected behavior

Either generate as many .trx files as there are targets (e.g. results.net45.trx, results.netcoreapp2.0.trx) OR assemble the results into the single .trx (if file format allows for it). Perhaps the user can pick a behavior.

Actual behavior

Only a single results.trx is created and it's contents only hold the results of the last target framework in the .csproj.

Environment

In case it matters, our multi-target project uses nunit 3.9 with the the following inside it's .csproj

<PackageReference Include="NUnit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="NunitXml.TestLogger" Version="1.1.0" />

that last bit is so we can also do dotnet test --logger:"nunit;LogFilePath=results.xml" since our CI can use either trx or nunit xml - but that also fails similarly.

OS: Windows 10 v1803
.NET SDK: dotnet --version shows 2.1.0
Not sure if/how dotnet test wraps over vstest but this is vstest.console.exe

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow>vstest.console.exe
Microsoft (R) Test Execution Command Line Tool Version 15.7.1
Copyright (c) Microsoft Corporation.  All rights reserved.
bug

Most helpful comment

The fix for this has been released. https://www.nuget.org/packages/Microsoft.TestPlatform/16.3.0-preview-20190828-03

We advice folks to use LogFilePrefix argument instead.

All 7 comments

Any news? Seems awfully similar to this https://github.com/Microsoft/vstest/issues/243. Regression?

Note that running just dotnet test "--logger:trx" causes it to generate unique filenames in a pattern like <username>_<machine>_YYYY-MM-DD_HH_MM_SS.trx but that's distinct from the reported problem.

@sidshetye Thanks for the feedback. This does not seem to be a regression.

@pvlakshm What do you think the spec should be for this one?

Please reopen, since the fix for this has been reverted.

@SidShetye @StephenCleary We are revisiting the scenario and would appreciate your inputs on the spec. Here is the RFC I have posted. Let me know if there are any concerns.

The fix for this has been released. https://www.nuget.org/packages/Microsoft.TestPlatform/16.3.0-preview-20190828-03

We advice folks to use LogFilePrefix argument instead.

Was this page helpful?
0 / 5 - 0 ratings