Skip to content

Test Runner: Integrate with Microsoft.Testing.Platform#358

Draft
Guillermo-Santos wants to merge 25 commits into
mainfrom
feature/test-mtp
Draft

Test Runner: Integrate with Microsoft.Testing.Platform#358
Guillermo-Santos wants to merge 25 commits into
mainfrom
feature/test-mtp

Conversation

@Guillermo-Santos

@Guillermo-Santos Guillermo-Santos commented May 26, 2026

Copy link
Copy Markdown
Collaborator

This PR tries to integrate Cosmos Test Runner with Microsoft Testing Platform (MTP) for native testing with the dotnet test command and VS and VSCode debuggers.

Current Workflow Steps:

  1. Build the Test Project with COSUnit_BuildKernel empty or set to false.
  2. A kernel is Source Generated for each TestClass with at least one valid TestMethod (Withour parameters and the Skip Attribute).
  3. Pass the project file as a parameter with --projectfile "$(MSBuildProjectFullPath).
  4. Once the Test App Starts it takes the project file and starts the Test Runner Engine, it sets COSUnit_BuildKernel to true and CosmosKernelClass to the Generated Kernel class, any method marked as Skip is reported as Skipped as the source generator doesn't see them.
  5. It Collects the results from the Test Runner Engine and translate them to MTP.

TODO:

  • Generate a Kernel from the attributed methods.
  • Build and Execute a Kernel Succesfully.
  • Translate results from the Test Runner Engine.
  • Migrate the complete Test Runner to Cosmos.TestingFramework, this would allow to do some enhancements to the engine, like live reporting of a test state and Custom Properties for Test Nodes.
  • Use testconfig.json for Test Runner Configuration.
  • Decide, should one kernel be made for each TestClass or only one for all TestMethods.
  • Enhance reporting of test duration from the Test Runner Engine, we should Collect Start and End TimeStamps (Both may be collected from the Test Start and Test Success Events respectively if live reporting of Test State is implemented).
  • Refactor current Test Kernels.
  • Integrate with VS and VSCode Test Explorers.

Known Issues:

  1. Cosmos Test Runner depends on the project file for building the Kernel, this bring problems when integrating to Visual Studio and Visual Studio Code Test Explorers as they execute the output exe resulted from build, so it doesn't see the project file we append with TestingPlatformCommandLineArguments. Consider building a workflow that starts from the Patcher Step downward from the dlls present in the output folder (Current Working Directory for this instances).

References:

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 HelloWorld Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 3 3 0 0 35.172s ✅ Passed
arm64 3 3 0 0 43.518s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Runtime Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 103 103 0 0 40.559s ✅ Passed
arm64 103 103 0 0 41.710s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 GarbageCollector Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 41 41 0 0 37.760s ✅ Passed
arm64 41 41 0 0 43.613s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 TypeCasting Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 17 17 0 0 36.254s ✅ Passed
arm64 17 17 0 0 41.168s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Network Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 10 10 0 0 40.367s ✅ Passed
arm64 10 10 0 0 43.660s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Timer Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 14 14 0 0 36.382s ✅ Passed
arm64 8 8 0 0 36.947s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Power Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 5 5 0 0 42.827s ✅ Passed
arm64 5 5 0 0 53.958s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Graphic Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 5 5 0 0 37.175s ✅ Passed
arm64 5 5 0 0 39.344s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Threading Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 49 49 0 0 50.809s ✅ Passed
arm64 49 49 0 0 57.185s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Memory Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 68 68 0 0 36.323s ✅ Passed
arm64 68 68 0 0 41.839s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🧪 Math Tests

Architecture Tests Passed Failed Skipped Duration Status
x64 30 30 0 0 37.220s ✅ Passed
arm64 30 30 0 0 43.676s ✅ Passed

📎 Artifacts

Architecture Test Results UART Log Kernel ISO
x64 XML Log ISO
arm64 XML Log ISO

📋 View full test summary | 📄 Kernel.cs

@Guillermo-Santos Guillermo-Santos marked this pull request as draft May 26, 2026 01:00
This commits allow to override default values for the testing configuration using the `testconfig.json` file.

As a plus some options are set as command line parameters, so that they can be overrided.
Comment thread Directory.Build.props
@Guillermo-Santos

Copy link
Copy Markdown
Collaborator Author

All all tests, including kernel tests, moved to MTP successfully 🥳

Next thing to do is to add support to the coverage options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants