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

Write props of tests into trx #14905

Merged
merged 2 commits into from
Jan 20, 2025
Merged

Conversation

nohwnd
Copy link
Member

@nohwnd nohwnd commented Jan 17, 2025

Write Traits into Properties section of TRX.

[TestProperty("some property", "some value")] // MSTest

[Property("some property", "some value")] // NUnit

[Trait("some property", "some value")] //Xunit

TRX:

 <UnitTest name="TestMethod1_1" storage="s:\t\mstest1.dll" id="0b592ca2-9fc4-1d7f-bdcd-3e8f8a552f24">
      <Properties>
        <Property Key="custom-owner" Value="Jakub" />
        <Property Key="my-service" Value="my service" />
        <Property Key="some prop" Value="some value" />
      </Properties>
      <Execution id="4bdf49fd-c016-4258-b63b-c5f8e65352ab" />
      <TestMethod codeBase="S:\t\MSTest1.dll" adapterTypeName="executor://mstestadapter/v2"
         className="MSTest1.UnitTest1" name="TestMethod1_1" />
    </UnitTest>

Where property attributes can be placed is controlled by the testing framework.

  • mstest, only on methods
  • xunit on classes and methods
  • nunit on assemblies, classes, and methods

Each property on assembly and class is propagated to all child tests.

@nohwnd nohwnd marked this pull request as draft January 17, 2025 14:34
@nohwnd nohwnd marked this pull request as ready for review January 17, 2025 14:39
@nohwnd nohwnd enabled auto-merge (squash) January 17, 2025 14:39
@nohwnd nohwnd disabled auto-merge January 20, 2025 11:28
@nohwnd nohwnd merged commit fa4e09f into microsoft:main Jan 20, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

1 participant