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

Inconsistency in TRX logging between .NET Core 3.1.103 and 3.1.300 #2457

Closed
GeorchW opened this issue Jun 9, 2020 · 5 comments
Closed

Inconsistency in TRX logging between .NET Core 3.1.103 and 3.1.300 #2457

GeorchW opened this issue Jun 9, 2020 · 5 comments
Assignees

Comments

@GeorchW
Copy link

GeorchW commented Jun 9, 2020

Description

The TRX logs are different between .NET Core 3.1.103 and 3.1.300. We noticed while relying on the output in the VSCode .NET Test Explorer extension: formulahendry/vscode-dotnet-test-explorer#267

Steps to reproduce

  1. Clone this repo: https://github.com/formulahendry/vscode-dotnet-test-explorer/
  2. cd to this folder: https://github.com/formulahendry/vscode-dotnet-test-explorer/tree/master/test/xunittests
  3. Run dotnet test --no-build --logger "trx;LogFileName=testResultsXml.trx" --filter "FullyQualifiedName=XunitTests.TestClass3.Fail" in both versions of the .NET Core SDK

Expected behavior

The generated TRX file follows some kind of specification and is consistent.

Actual behavior

The TRX file differs. The output for .NET Core 3.1.103 is:

<TestDefinitions>
  <UnitTest name="XunitTests.TestClass3.Fail(value: 2)" storage="/path/to/the/repo/vscode-dotnet-test-explorer/test/xunittests/bin/debug/netcoreapp3.1/xunittests.dll" id="5d23175e-8479-779f-39f4-23aa2608428b">
    <Execution id="285b15ac-175b-4204-8d35-32dab901e73d" />
    <TestMethod codeBase="/path/to/the/repo/vscode-dotnet-test-explorer/test/xunittests/bin/Debug/netcoreapp3.1/XunitTests.dll" adapterTypeName="executor://xunit/VsTestRunner2/netcoreapp" className="XunitTests.TestClass3" name="XunitTests.TestClass3.Fail(value: 2)" />
  </UnitTest>
</TestDefinitions>

while .NET Core 3.1.300 returns:

<TestDefinitions>
    <UnitTest name="XunitTests.TestClass3.Fail(value: 2)" storage="d:\SomePath\vscode-dotnet-test-explorer\test\xunittests\bin\debug\netcoreapp3.1\xunittests.dll" id="5d23175e-8479-779f-39f4-23aa2608428b">
      <Execution id="ceaf151e-e91c-4f92-ba85-4af475de7c28" />
      <TestMethod codeBase="d:\SomePath\vscode-dotnet-test-explorer\test\xunittests\bin\Debug\netcoreapp3.1\XunitTests.dll" adapterTypeName="executor://xunit/VsTestRunner2/netcoreapp" className="XunitTests.TestClass3" name="Fail" />
    </UnitTest>
  </TestDefinitions>

Note the differences in TestDefinitions/UnitTest/TestMethod/@name.

Environment

Happens under both Windows and Linux.

Actual question

On which behaviour should we rely in the future? What string is supposed to be contained in UnitTest/TestMethod/@name and UnitTest/@name? Is there documentation about this somewhere?

@Sanan07 Sanan07 self-assigned this Jun 9, 2020
@Sanan07
Copy link
Contributor

Sanan07 commented Jun 9, 2020

@GeorchW Rely on .NET Core 3.1.300 version. There is no documentation on it, but you can look at the change : #2355 @nohwnd

@GeorchW
Copy link
Author

GeorchW commented Jun 9, 2020

Okay, can you tell me what value TestDefinitions/UnitTest/@name contains? Is it just the un-split test method name? Or is it possible for a UnitTest node to contain multiple TestMethods?

@Sanan07
Copy link
Contributor

Sanan07 commented Jun 9, 2020

TestDefinitions/UnitTest/@name - contains name of the test method. UnitTest contains only one TestMethod.

@Sanan07
Copy link
Contributor

Sanan07 commented Jun 10, 2020

@GeorchW is everything clear now?

@GeorchW
Copy link
Author

GeorchW commented Jun 10, 2020

Yeah, it works now

@GeorchW GeorchW closed this as completed Jun 10, 2020
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

2 participants