Skip to content

feat(testing): migrate test infrastructure to Microsoft Testing Platform#288

Merged
j-d-ha merged 6 commits into
mainfrom
feature/update-tests-to-use-mtp
Jan 19, 2026
Merged

feat(testing): migrate test infrastructure to Microsoft Testing Platform#288
j-d-ha merged 6 commits into
mainfrom
feature/update-tests-to-use-mtp

Conversation

@j-d-ha

@j-d-ha j-d-ha commented Jan 19, 2026

Copy link
Copy Markdown
Collaborator

🚀 Pull Request

📋 Summary

This PR migrates the test infrastructure from xUnit's legacy test runner to Microsoft Testing Platform (MTP), the modern native .NET test execution framework. This migration modernizes our testing infrastructure and improves code coverage collection through native .NET tooling.

Key Changes

  1. Microsoft Testing Platform Migration

    • Updated global.json to specify MTP as the test runner ("runner": "Microsoft.Testing.Platform")
    • Added Microsoft.Testing.Extensions.CodeCoverage package to all test projects
    • Replaced Coverlet with native MTP coverage collection
    • All test projects now use MTP for execution and coverage
  2. Package Management Modernization

    • Normalized and aligned package references across all projects in Directory.Packages.props
    • Ensured consistent versioning for test-related dependencies
    • Cleaned up package reference structure
  3. CI/CD Workflow Updates

    • Updated both main-build.yaml and pr-build.yaml workflows
    • Changed coverage collection from --collect:"XPlat Code Coverage" to --coverage --coverage-output-format cobertura
    • Updated Codecov file pattern to match new output format (*.cobertura.xml)
  4. Documentation & Configuration

    • Added comprehensive test command reference to CLAUDE.md with examples for:
      • Running tests across multiple frameworks
      • Framework-specific test execution
      • Test discovery and filtering with MTP syntax (method, class, namespace)
    • Updated CONTRIBUTING.md with correct coverage command
    • Updated TestTasks.yml to use MTP-specific filter syntax (--filter-trait)
    • Added opencode.json configuration file
  5. Testing Infrastructure Enhancement

    • Modified LambdaApplicationFactory to ensure minimum 30-second shutdown timeout for test reliability
    • This prevents premature test termination during cleanup

✅ Checklist

  • My changes build cleanly
  • I've added/updated relevant tests (N/A - infrastructure changes)
  • I've added/updated documentation or README
  • I've followed the coding style for this project
  • I've tested the changes locally

🧪 Related Issues or PRs

Modernizes testing infrastructure and improves coverage reporting capabilities.


💬 Notes for Reviewers

  • Primary change: Migration from legacy xUnit runner to Microsoft Testing Platform (MTP)
  • MTP provides better integration with modern .NET tooling and native coverage collection
  • All test projects have been updated consistently to use the new MTP execution model
  • The 30-second minimum shutdown timeout in LambdaApplicationFactory prevents race conditions during test cleanup
  • CI workflows now use native .NET coverage instead of requiring external collectors
  • Documentation includes comprehensive examples for MTP-specific test filtering syntax

j-d-ha and others added 3 commits January 19, 2026 07:39
- Introduced `opencode.json` for configuring permissions.
- Set `git` permission level to require explicit confirmation.
- Switched to `--coverage` and `cobertura` output format for streamlined coverage reporting.
- Added `Microsoft.Testing.Extensions.CodeCoverage` dependency across all unit test projects.
- Introduced test commands and filtering examples in documentation.
- Improved GitHub Actions workflows to upload consistent coverage reports.
- Enforced a minimum shutdown timeout of 30 seconds in `LambdaApplicationFactory`.
Signed-off-by: Jonas Ha <61319894+j-d-ha@users.noreply.github.com>
@github-actions github-actions Bot added the type: feat New feature label Jan 19, 2026
- Introduced task wrappers for common testing workflows.
- Updated direct `dotnet` command examples with detailed use cases.
- Added test filtering examples for improved usability.
- Replaced outdated project references with `MinimalLambda.UnitTests`.
… projects

- Fixed inconsistent formatting of `Microsoft.Testing.Extensions.CodeCoverage` references.
- Adjusted SDK version in `global.json` from `10.0.102` to `10.0.101`.
@j-d-ha j-d-ha changed the title feat(testing): enhance testing with improved coverage support feat(testing): migrate test infrastructure to Microsoft Testing Platform Jan 19, 2026
- Corrected whitespace formatting for `Microsoft.Testing.Extensions.CodeCoverage` in `Directory.Packages.props`.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jan 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #288      +/-   ##
==========================================
+ Coverage   87.49%   87.70%   +0.21%     
==========================================
  Files         131      131              
  Lines        3246     3253       +7     
  Branches      318      352      +34     
==========================================
+ Hits         2840     2853      +13     
+ Misses        302      298       -4     
+ Partials      104      102       -2     
Files with missing lines Coverage Δ
.../MinimalLambda.Testing/LambdaApplicationFactory.cs 69.30% <100.00%> (+1.03%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d1d6d9...b0a619e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@j-d-ha
j-d-ha merged commit 3eecbb0 into main Jan 19, 2026
8 checks passed
@j-d-ha
j-d-ha deleted the feature/update-tests-to-use-mtp branch January 19, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant