Skip to content

Add support for NUnitV3 content inside TouchUnit result files.#1505

Merged
rolfbjarne merged 3 commits intodotnet:mainfrom
rolfbjarne:touch-unit-test-report-generator
Dec 1, 2025
Merged

Add support for NUnitV3 content inside TouchUnit result files.#1505
rolfbjarne merged 3 commits intodotnet:mainfrom
rolfbjarne:touch-unit-test-report-generator

Conversation

@rolfbjarne
Copy link
Member

  • Add a new TouchUnit_NUnitV3 xml result jargon.
  • Refactor the TouchUnit test report generator to call into the NUnitV2 or NUnitV3 test report generators depending on the embedded content.
  • Simplify the NUnitV3 test report generator to just look for 'test-case' elements, not caring about any parent nodes.
  • Make the NUnitV3 test report print the full name of failing tests, not just the name.

* Add a new TouchUnit_NUnitV3 xml result jargon.
* Refactor the TouchUnit test report generator to call into the NUnitV2 or NUnitV3 test report generators depending on the embedded content.
* Simplify the NUnitV3 test report generator to just look for 'test-case' elements, not caring about any parent nodes.
* Make the NUnitV3 test report print the full name of failing tests, not just the name.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for NUnitV3-formatted content within TouchUnit result files, previously only NUnitV2 format was supported. The implementation introduces a new TouchUnit_NUnitV3 XML result jargon while maintaining backward compatibility through an enum alias (TouchUnit_NUnitV2 = TouchUnit). The core change refactors the TouchUnitTestReportGenerator to detect the embedded format and delegate to the appropriate NUnitV2 or NUnitV3 test report generator, simplifying the code and eliminating duplication.

Key changes:

  • Introduces TouchUnit_NUnitV3 enum value with backward-compatible alias for TouchUnit
  • Detection logic in XmlResultParser distinguishes between TouchUnit variants based on presence of 'test-run' (NUnitV3) or 'test-results' (NUnitV2) elements
  • NUnitV3TestReportGenerator simplified to iterate through all test-case elements using fullname instead of name for failed tests

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Microsoft.DotNet.XHarness.Common/XmlResultJargon.cs Adds TouchUnit_NUnitV3 enum value and backward-compatible alias TouchUnit_NUnitV2 = TouchUnit
src/Microsoft.DotNet.XHarness.iOS.Shared/XmlResults/XmlResultParser.cs Updates detection logic to distinguish between TouchUnit variants and adds both to the formatters dictionary
src/Microsoft.DotNet.XHarness.iOS.Shared/XmlResults/TouchUnitTestReportGenerator.cs Refactored to delegate to NUnitV2 or NUnitV3 generators based on detected element name
src/Microsoft.DotNet.XHarness.iOS.Shared/XmlResults/NUnitV3TestReportGenerator.cs Simplified to iterate all test-case elements directly; changed to use fullname attribute instead of name
src/Microsoft.DotNet.XHarness.iOS.Shared/XmlResults/NUnitV2TestReportGenerator.cs Added check to handle reader already positioned at test-results element
tests/Microsoft.DotNet.XHarness.iOS.Shared.Tests/XmlResultParserTests.cs Updated tests for new enum values and added two new test methods for TouchUnit report generation
tests/Microsoft.DotNet.XHarness.iOS.Shared.Tests/Microsoft.DotNet.XHarness.iOS.Shared.Tests.csproj Added TouchUnitSample2.xml as embedded resource for testing

rolfbjarne and others added 2 commits December 1, 2025 16:23
…erTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…erTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rolfbjarne rolfbjarne enabled auto-merge (squash) December 1, 2025 15:24
@rolfbjarne rolfbjarne merged commit 8c52965 into dotnet:main Dec 1, 2025
17 checks passed
@rolfbjarne rolfbjarne deleted the touch-unit-test-report-generator branch December 1, 2025 15:47
kotlarmilos pushed a commit to kotlarmilos/xharness that referenced this pull request Mar 16, 2026
…t#1505)

* Add support for NUnitV3 content inside TouchUnit result files.

* Add a new TouchUnit_NUnitV3 xml result jargon.
* Refactor the TouchUnit test report generator to call into the NUnitV2 or NUnitV3 test report generators depending on the embedded content.
* Simplify the NUnitV3 test report generator to just look for 'test-case' elements, not caring about any parent nodes.
* Make the NUnitV3 test report print the full name of failing tests, not just the name.
kotlarmilos pushed a commit to kotlarmilos/xharness that referenced this pull request Mar 16, 2026
…t#1505)

* Add support for NUnitV3 content inside TouchUnit result files.

* Add a new TouchUnit_NUnitV3 xml result jargon.
* Refactor the TouchUnit test report generator to call into the NUnitV2 or NUnitV3 test report generators depending on the embedded content.
* Simplify the NUnitV3 test report generator to just look for 'test-case' elements, not caring about any parent nodes.
* Make the NUnitV3 test report print the full name of failing tests, not just the name.
kotlarmilos pushed a commit to kotlarmilos/xharness that referenced this pull request Mar 16, 2026
…t#1505)

* Add support for NUnitV3 content inside TouchUnit result files.

* Add a new TouchUnit_NUnitV3 xml result jargon.
* Refactor the TouchUnit test report generator to call into the NUnitV2 or NUnitV3 test report generators depending on the embedded content.
* Simplify the NUnitV3 test report generator to just look for 'test-case' elements, not caring about any parent nodes.
* Make the NUnitV3 test report print the full name of failing tests, not just the name.
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.

3 participants