Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Description

Documentation incorrectly showed dotnet test --coverage --report-trx, causing MSB1001 "Unknown switch" errors. TUnit uses Microsoft.Testing.Platform, which requires test application flags to be passed after the -- separator when using dotnet test.

Before:

dotnet test --configuration Release --no-build --coverage --report-trx --results-directory ./TestResults
# Result: MSBUILD : error MSB1001: Unknown switch.

After:

dotnet test --configuration Release --no-build -- --coverage --report-trx --results-directory ./TestResults
# Result: Tests pass, coverage and TRX files generated

Changes

  • CI Pipeline Examples (docs/docs/examples/tunit-ci-pipeline.md): Fixed GitHub Actions, Azure DevOps, GitLab CI workflows (5 instances)
  • CI/CD Reporting (docs/docs/execution/ci-cd-reporting.md): Fixed Azure DevOps, Jenkins, GitLab examples (3 instances)
  • Troubleshooting (docs/docs/troubleshooting.md): Fixed timeout configuration example (1 instance)
  • Performance Guide (docs/docs/advanced/performance-best-practices.md): Fixed fail-fast example (1 instance)

Note: .NET 10+ examples explicitly marked as using optional separator syntax remain unchanged.

Related Issue

Issue linking handled by system

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Checklist

Required

  • I have read the Contributing Guidelines
  • If this is a new feature, I started a discussion first and received agreement
  • My code follows the project's code style (modern C# syntax, proper naming conventions)
  • I have written tests that prove my fix is effective or my feature works

TUnit-Specific Requirements

  • Dual-Mode Implementation: If this change affects test discovery/execution, I have implemented it in BOTH:
    • Source Generator path (TUnit.Core.SourceGenerator)
    • Reflection path (TUnit.Engine)
  • Snapshot Tests: If I changed source generator output or public APIs:
    • I ran TUnit.Core.SourceGenerator.Tests and/or TUnit.PublicAPI tests
    • I reviewed the .received.txt files and accepted them as .verified.txt
    • I committed the updated .verified.txt files
  • Performance: If this change affects hot paths (test discovery, execution, assertions):
    • I minimized allocations and avoided LINQ in hot paths
    • I cached reflection results where appropriate
  • AOT Compatibility: If this change uses reflection:
    • I added appropriate [DynamicallyAccessedMembers] annotations
    • I verified the change works with dotnet publish -p:PublishAot=true

Testing

  • All existing tests pass (dotnet test)
  • I have added tests that cover my changes
  • I have tested both source-generated and reflection modes (if applicable)

Additional Notes

Verified with fresh TUnit template project (dotnet new TUnit -n "MyTest"):

  • Old command: MSB1001 error
  • New command: 52 tests passed, coverage/TRX files generated

The -- separator is required for .NET 8/9 SDKs. .NET 10+ makes it optional (documented with explicit notes in affected files).

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Documented workflow does not work in GitHub Actions</issue_title>
<issue_description>### Description

According to the documentation, the following code should execute the tests in the build pipeline:

dotnet test --configuration Release --no-build --coverage --report-trx --results-directory ./TestResults

However the pipeline fails with MSB1001.

I also tried to run the command locally on the template project and get the same error:
Image

Expected Behavior

A clear command to run TUnit with coverage information in a GitHub action build pipeline

Actual Behavior

The documented command fails

Steps to Reproduce

  • Create a TUnit template project (dotnet new TUnit -n "MyTest")
  • Run dotnet build --configuration Release --no-restore
  • Run dotnet test --configuration Release --no-build --coverage --report-trx --results-directory ./TestResults

TUnit Version

1.5.53

.NET Version

.NET 8.0

Operating System

Windows

IDE / Test Runner

dotnet CLI (dotnet test / dotnet run)

Error Output / Stack Trace

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 15, 2025 16:10
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix documented workflow for GitHub Actions Fix dotnet test command syntax in documentation for Microsoft.Testing.Platform Dec 15, 2025
Copilot AI requested a review from thomhurst December 15, 2025 16:21
@thomhurst thomhurst marked this pull request as ready for review December 28, 2025 12:12
@thomhurst thomhurst merged commit 34850df into main Dec 28, 2025
19 of 21 checks passed
@thomhurst thomhurst deleted the copilot/fix-github-actions-workflow branch December 28, 2025 12:12
This was referenced Dec 29, 2025
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.

[Bug]: Documented workflow does not work in GitHub Actions

2 participants