From eeb9ea93559755793471e424632e85881e5d1a6d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:31:21 +0000 Subject: [PATCH 1/4] Initial plan From 90ddd8e775cebdf18750eab6117d6b08fd139b18 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:34:36 +0000 Subject: [PATCH 2/4] Cleanup README.md: Add NuGet badge, fix features, merge examples Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --- README.md | 47 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index cd75071..ba061e1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ ![Build](https://github.com/demaconsulting/TestResults/actions/workflows/build_on_push.yaml/badge.svg) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=demaconsulting_TestResults&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=demaconsulting_TestResults) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=demaconsulting_TestResults&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=demaconsulting_TestResults) +[![NuGet](https://img.shields.io/nuget/v/DemaConsulting.TestResults?style=plastic)](https://www.nuget.org/packages/DemaConsulting.TestResults) A lightweight C# library for programmatically creating test result files in TRX and JUnit formats. @@ -17,8 +18,8 @@ A lightweight C# library for programmatically creating test result files in TRX - ðŸŠķ **Lightweight** - Minimal external dependencies - 🔄 **Multi-Target** - Supports .NET 8, 9, and 10 - ðŸ“Ķ **NuGet Ready** - Easy integration via NuGet package -- ✅ **Compatible** - Generates TRX files compatible with Visual Studio, Azure DevOps, and other Microsoft testing tools - 📊 **Multiple Formats** - Supports both TRX and JUnit XML formats +- ✅ **Compatible** - Works with Visual Studio, Azure DevOps, and CI/CD systems ## Installation @@ -36,9 +37,9 @@ Install-Package DemaConsulting.TestResults ## Quick Start -### Creating TRX Files +### Creating Test Result Files -The following code-snippet shows how to create a TRX test-results file: +The following code-snippet shows how to create test result files in both TRX and JUnit XML formats: ```csharp using DemaConsulting.TestResults; @@ -72,46 +73,10 @@ results.Results.Add( }); // Save the results to TRX file -File.WriteAllText( - "results.trx", - TrxSerializer.Serialize(results)); -``` - -### Creating JUnit XML Files - -The following code-snippet shows how to create a JUnit XML test-results file: - -```csharp -using DemaConsulting.TestResults; -using DemaConsulting.TestResults.IO; - -// Create a TestResults instance -var results = new TestResults { Name = "SomeTests" }; - -// Add some results -results.Results.Add( - new TestResult - { - Name = "Test1", - ClassName = "SomeTestClass", - Outcome = TestOutcome.Passed, - Duration = TimeSpan.FromSeconds(1.5) - }); - -results.Results.Add( - new TestResult - { - Name = "Test2", - ClassName = "SomeTestClass", - Outcome = TestOutcome.Failed, - ErrorMessage = "Expected value to be 42 but was 0", - ErrorStackTrace = "at SomeTestClass.Test2() in Test.cs:line 15" - }); +File.WriteAllText("results.trx", TrxSerializer.Serialize(results)); // Save the results to JUnit XML file -File.WriteAllText( - "results.xml", - JUnitSerializer.Serialize(results)); +File.WriteAllText("results.xml", JUnitSerializer.Serialize(results)); ``` ### Converting Between Formats From 92773bc1f84160815d14c4e0ab5705420184ba60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:35:31 +0000 Subject: [PATCH 3/4] Simplify use case description for better clarity Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba061e1..e0ff76b 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ This library is useful when you need to: - Convert test results between formats (TRX ↔ JUnit) - Create test reports programmatically - Aggregate test results from multiple sources -- Build custom testing tools that integrate with Visual Studio, Azure DevOps, or CI/CD systems that consume JUnit XML +- Build custom testing tools that integrate with Visual Studio, Azure DevOps, or CI/CD systems ## Documentation From 3549c2c237e43287dde04c0c132ff19274818815 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:36:32 +0000 Subject: [PATCH 4/4] Add clarifying comments to file save operations Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0ff76b..5a7c98f 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ results.Results.Add( ErrorStackTrace = "at SomeTestClass.Test2() in Test.cs:line 15" }); -// Save the results to TRX file +// Save the results to a TRX file (Visual Studio format) File.WriteAllText("results.trx", TrxSerializer.Serialize(results)); -// Save the results to JUnit XML file +// Save the results to a JUnit XML file File.WriteAllText("results.xml", JUnitSerializer.Serialize(results)); ```