Skip to content

Add general-purpose Serializer with automatic format detection#70

Merged
Malcolmnixon merged 7 commits intomainfrom
copilot/add-general-purpose-deserializer
Jan 13, 2026
Merged

Add general-purpose Serializer with automatic format detection#70
Malcolmnixon merged 7 commits intomainfrom
copilot/add-general-purpose-deserializer

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

Implementation Plan for General-Purpose Deserializer

  • Explore existing serializers and test patterns
  • Create Serializer.cs with format identification logic
  • Implement Identify method to detect TRX vs JUnit format
  • Implement Deserialize method to deserialize based on detected format
  • Create SerializerTests.cs with comprehensive test coverage
  • Test with TRX format detection and deserialization
  • Test with JUnit format detection and deserialization
  • Test edge cases (invalid XML, unknown formats, empty content)
  • Run build and tests to validate implementation
  • Run code review and address feedback
  • Run security scanning (0 alerts found)
  • Address new requirement to inline single-use constant
  • Update documentation (README.md and ARCHITECTURE.md)
  • Update user guide (docs/guide/guide.md)
  • Fix markdown linting errors
  • Run all quality checks (markdownlint, yamllint, cspell)
  • Complete task

Summary

Successfully implemented a general-purpose deserializer as requested. The implementation includes:

New Files

  1. src/DemaConsulting.TestResults/IO/Serializer.cs

    • TestResultFormat enum (Unknown, Trx, JUnit)
    • Identify() method - detects format by analyzing XML root element and namespace
    • Deserialize() method - automatically uses the appropriate deserializer based on format
  2. test/DemaConsulting.TestResults.Tests/IO/SerializerTests.cs

    • 13 comprehensive unit tests covering all scenarios
    • Tests for both TRX and JUnit format identification
    • Tests for edge cases (empty, null, whitespace, invalid XML, unknown formats)
    • Tests using real example files

Documentation Updates

  • README.md: Added "Automatic Format Detection" section with code examples
  • ARCHITECTURE.md: Added Serializer class documentation, updated data flow, removed completed future consideration
  • docs/guide/guide.md: Added automatic format detection section, updated conversion examples, added FAQ entry

Quality Checks

  • ✅ All 40 tests passing across .NET 8, 9, and 10
  • ✅ Zero build warnings, zero errors
  • ✅ Markdown linting passes (markdownlint)
  • ✅ YAML linting passes (yamllint)
  • ✅ Spell checking passes (cspell)
  • ✅ Zero security alerts (CodeQL scan)

Key Features

  • Supports both TRX (with namespace) and JUnit (testsuites/testsuite root) formats
  • Gracefully handles invalid input by returning Unknown format
  • Follows existing code patterns and conventions
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Add General Purpose Deserializer</issue_title>
<issue_description>### Problem Statement

Users have to implement custom code to detect and handle TRX and JUnit files.

Proposed Solution

Create a general "src/DemaConsulting.TestResults/IO/Serializer.cs" file which implements two methods:

  • Identify - identifies the test type based on the contents
  • Deserialize - deserializes the test contents to TestResults using the appropriate deserialized (identified by the Identify method)

It would be appropriate to create a new unit test file for this Serializer class that tries different flavors of TRX and JUnit file contents.

Alternatives Considered

No response

Usage Examples

Benefits

Applications that consume test result files have a simpler API.

Priority

Medium - Would improve my workflow

Willingness to Contribute

Yes, I can submit a pull request

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I have provided a clear description of the feature
  • I have explained why this feature would be useful</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 13, 2026 02:29
…lization

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Add general purpose deserializer for test results Add general-purpose Serializer with automatic format detection Jan 13, 2026
Copilot AI requested a review from Malcolmnixon January 13, 2026 02:33
@Malcolmnixon
Copy link
Contributor

@copilot Please consider updating the supporting documentation for the new API.

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Please consider updating the supporting documentation for the new API.

Updated documentation in commit eb9313c:

  • Added "Automatic Format Detection" section to README.md with code examples showing Serializer.Identify() and Serializer.Deserialize() usage
  • Updated ARCHITECTURE.md with Serializer class documentation, data flow diagrams for reading test results, and removed the completed "Format Detection" future consideration

@Malcolmnixon
Copy link
Contributor

@copilot Please also consider updating the user guide

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Please also consider updating the user guide

Updated user guide in commit afe02a4:

  • Added "Automatic Format Detection" section with examples of Serializer.Identify() and Serializer.Deserialize()
  • Updated "Converting Between Formats" section to demonstrate automatic format detection
  • Updated "Aggregating Test Results" example to use automatic format detection
  • Added new FAQ entry explaining how to automatically detect test result file formats

@Malcolmnixon Malcolmnixon marked this pull request as ready for review January 13, 2026 02:43
@Malcolmnixon
Copy link
Contributor

@copilot Please run all quality checks - you introduced at least the following errors and failed to correct them before completing - there may be more:

Error: docs/guide/guide.md:462:121 MD013/line-length Line length [Expected: 120; Actual: 145] https://github.com/DavidAnson/markdownlint/blob/v0.40.0/doc/md013.md
Error: docs/guide/guide.md:501 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Processing test results from..."] https://github.com/DavidAnson/markdownlint/blob/v0.40.0/doc/md032.md
Error: docs/guide/guide.md:921:121 MD013/line-length Line length [Expected: 120; Actual: 312] https://github.com/DavidAnson/markdownlint/blob/v0.40.0/doc/md013.md

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Please run all quality checks - you introduced at least the following errors and failed to correct them before completing - there may be more:

Error: docs/guide/guide.md:462:121 MD013/l...

Fixed markdown linting errors in commit 417284f and verified all quality checks pass:

  • ✅ markdownlint: 0 errors (fixed MD013 line length violations and MD032 blank lines issue)
  • ✅ yamllint: passes (pre-existing warnings unrelated to my changes)
  • ✅ cspell: 0 spelling errors
  • ✅ dotnet build: 0 warnings, 0 errors
  • ✅ dotnet test: 40/40 tests passing

Copilot AI requested a review from Malcolmnixon January 13, 2026 03:16
@Malcolmnixon Malcolmnixon merged commit 4df5c2a into main Jan 13, 2026
9 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/add-general-purpose-deserializer branch January 13, 2026 03:19
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.

[Feature]: Add General Purpose Deserializer

2 participants

Comments