Skip to content

Unstable testId (Guid) - with /logger:trx switch #547

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

Closed
GraueEminenz79 opened this issue Sep 25, 2018 · 3 comments
Closed

Unstable testId (Guid) - with /logger:trx switch #547

GraueEminenz79 opened this issue Sep 25, 2018 · 3 comments
Labels
closed:done External Tracked here, but must be fixed in external tool VS Issue

Comments

@GraueEminenz79
Copy link

GraueEminenz79 commented Sep 25, 2018

  • NUnit Framework 3.10.1.0 and NUnit3TestAdapter 3.10.0
  • Visual Studio Enterprise 2017 - Version 15.8.4
  • dot Net target version 4.7.1
  • as well encountered in VSTS Build Task (TFS 2017 on premise Version 15.117.27024.0)

Given is one Unit Test named MyTest in assembly SomeAssemblyWithOneUTest.dll.
With every execution

vstest.console.exe SomeAssemblyWithOneUTest.dll /TestAdapterPath:"C:\SomePath" /logger:trx

different testIds for the test are generated.
Is this intended by design?

1st execution (trx content condensed)

<TestRun id="1d4f09c0-283d-4898-838d-39905d4b4d12" name="censored" runUser="censored">
   <Results>
        <UnitTestResult executionId="fb70c744-719f-4d10-9763-1340872ae83c" testId="f5932e8a-b639-445f-85ee-28b735f1d512" testName="MyTest" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" />
...

hence testId="f5932e8a-b639-445f-85ee-28b735f1d512"

2nd execution (trx content condensed)

<TestRun id="86ef4ada-0db3-4b96-b1e5-f925d5d78c63" name="censored" runUser="censored">
   <Results>
        <UnitTestResult executionId="d6c3acff-984c-4499-a12f-660e46435638" testId="63d6697b-c276-471e-89a1-b2e4a963256c" testName="MyTest" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed"  />

hence testId="63d6697b-c276-471e-89a1-b2e4a963256c"

EDIT:
To rule out that the adapterTypeName has changed in between, under <TestDefintions>the entries are identical:

<UnitTest name="MyTest" storage="SomeAssemblyWithOneUTest.dll" ...>
   <TestMethod codeBase="SomeAssemblyWithOneUTest.dll" adapterTypeName="executor://nunit3testexecutor/" className="NUnitTests" name="MyTest" /></UnitTest>
@OsirisTerje
Copy link
Member

hi! IIRC these Ids are created by the VSTest common test class objects, and not by any NUnit specific part at all.
That said, I am not sure why it is varying, my understanding is that the TestId in the trx file represents the test itself, and is a hash of the path and fully qualified name of the test method. That should be a stable guid.
And, when I test it locally (inside VS), I don't find any changes from run to run. On a build server however, this would change, since the path might change from build to build.
When I test it on the command line however, I get the exact same results that you do, they indeed do vary. No clue why though. I'll ping this to some MS guy and ask if they know.
But in any case, this is not adapter related.

@abhishkk
Copy link
Contributor

abhishkk commented Oct 5, 2018

@GraueEminenz79 @OsirisTerje
We recently made trx generate hierarchical results for adapters which send hierarchical results.
For supporting both non-hierarchical and hierarchical results, we made some code changes which caused test guid id to change.
We have fixed this issue. Vstest issue link: microsoft/vstest#1783

@OsirisTerje
Copy link
Member

@abhishkk Superb! I assume this will then be part of the next VS update ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:done External Tracked here, but must be fixed in external tool VS Issue
Projects
None yet
Development

No branches or pull requests

3 participants