Skip to content

Conversation

@dsarno
Copy link
Owner

@dsarno dsarno commented Jan 1, 2026

Motivation

  • Align unit test assertions with the actual output of RunTests.FormatTestResultMessage.
  • Remove the unreachable "no tests found" check which the formatter never produces.
  • Reduce confusion for future maintainers by making test expectations explicit and accurate.

Description

  • Update TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/RunTestsTests.cs to simplify assertions.
  • Replace two assertions that used || message.Contains("no tests found") with checks that only use message.Contains("No tests matched").
  • No production code behavior was changed; only test expectations were adjusted.

Testing

  • No automated tests were executed as part of this change.

Codex Task

@coderabbitai
Copy link

coderabbitai bot commented Jan 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dsarno dsarno merged commit 007f354 into optimize-run-tests Jan 1, 2026
3 checks passed
@dsarno dsarno deleted the codex/refactor-assertions-in-runteststests branch January 1, 2026 10:47
@greptile-apps
Copy link

greptile-apps bot commented Jan 1, 2026

Greptile Summary

Cleaned up test assertions to align with actual production code behavior. Removed the unreachable "no tests found" condition from two assertions, leaving only the "No tests matched" check that FormatTestResultMessage actually produces (line 131 in RunTests.cs). This makes the test expectations more accurate and reduces maintainer confusion.

Confidence Score: 5/5

  • This PR is completely safe to merge with zero risk
  • The change only simplifies test assertions to match actual production behavior, removing an impossible condition. No production code was modified, and the tests still verify the exact same functionality with more precise expectations.
  • No files require special attention

Important Files Changed

Filename Overview
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/RunTestsTests.cs Simplified assertions to match actual formatter output, removing unreachable "no tests found" check

Sequence Diagram

sequenceDiagram
    participant Test as RunTestsTests
    participant RunTests as RunTests.FormatTestResultMessage
    
    Note over Test,RunTests: Test Case 1: No Tests Scenario
    Test->>RunTests: Call with total=0
    RunTests-->>Test: Returns message with "No tests matched"
    Test->>Test: Assert.IsTrue(contains "No tests matched")
    Note over Test: ✓ Simplified from "No tests matched" OR "no tests found"
    
    Note over Test,RunTests: Test Case 2: Tests Exist Scenario
    Test->>RunTests: Call with total=5
    RunTests-->>Test: Returns message with "4/5 passed"
    Test->>Test: Assert.IsFalse(contains "No tests matched")
    Note over Test: ✓ Simplified from checking both conditions
    Test->>Test: Assert.IsTrue(contains "4/5 passed")
Loading

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants