Skip to content

Split TimeoutTests into separate classes with single asset each#7580

Merged
Evangelink merged 2 commits intomainfrom
copilot/fix-multiple-test-assets-issue
Mar 20, 2026
Merged

Split TimeoutTests into separate classes with single asset each#7580
Evangelink merged 2 commits intomainfrom
copilot/fix-multiple-test-assets-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

TimeoutTests had 7 assets in a single GetAssetsToGenerate override, causing all assets to build during class initialization regardless of which tests run — blocking parallelism and wasting build time.

Changes

  • TimeoutTests.cs — stripped to only the 5 CLI --timeout extension tests (asset: TimeoutTest)
  • TimeoutWhenCanceledTests.cs*_WhenTestContextCanceled_* tests (asset: 60s timeout lifecycle project)
  • TimeoutWhenExpiresTests.cs*_WhenTimeoutExpires_* and *_AttributeTakesPrecedence tests (asset: 1s timeout lifecycle project)
  • TimeoutFromRunSettingsTests.cs*_FromRunSettings_* tests (asset: no-timeout lifecycle project)
  • TimeoutCooperativeCancellationTests.csCooperativeCancellation_* tests (asset: cooperative cancellation lifecycle project)
  • TimeoutTestMethodTests.csTimeout_WhenMethodTimeout* tests (asset: [Timeout(1000)] on test method)
  • TimeoutCooperativeTestMethodTests.csCooperativeTimeout_WhenMethodTimeout* tests (asset: [Timeout(1000, CooperativeCancellation = true)] on test method)

RunAndAssertWithRunSettingsAsync (which previously branched on two assets) was split into RunAndAssertAttributeTakesPrecedenceAsync and RunAndAssertFromRunSettingsAsync, each living in the class that owns the relevant asset.

Original prompt

This section details on the original issue you should resolve

<issue_title>Avoid having multiple test assets in a single test class</issue_title>
<issue_description>Continuation of #7552.

Overrides of GetAssetsToGenerate should have no reason to provide multiple assets. Having multiple assets means that all of these will be built during class initialize, reducing the ability to run more stuff in parallel, and forcing the build of irrelevant assets when running a single test that uses one of those assets. Currently, the only test class with multiple assets is test\IntegrationTests\MSTest.Acceptance.IntegrationTests\TimeoutTests.cs</issue_description>

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


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

… each

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with multiple test assets in single test class Split TimeoutTests into separate classes with single asset each Mar 20, 2026
Copilot AI requested a review from Youssef1313 March 20, 2026 10:25
@Youssef1313 Youssef1313 marked this pull request as ready for review March 20, 2026 11:10
Copilot AI review requested due to automatic review settings March 20, 2026 11:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the MSTest acceptance timeout integration tests to ensure each test class generates/builds only a single test asset, improving parallelism and reducing unnecessary asset builds during class initialization.

Changes:

  • Split the former multi-asset TimeoutTests suite into multiple single-asset test classes.
  • Kept TimeoutTests.cs focused on CLI --timeout parsing/behavior tests with a single TimeoutTest asset.
  • Introduced dedicated classes/assets for timeout expiration, test-context cancellation, runsettings-based timeouts, cooperative cancellation, and method-level timeout scenarios.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs Reduced to the 5 CLI --timeout extension tests and a single TimeoutTest asset.
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenCanceledTests.cs New single-asset class covering *_WhenTestContextCanceled_* scenarios.
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenExpiresTests.cs New single-asset class covering *_WhenTimeoutExpires_* + attribute precedence scenarios.
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutFromRunSettingsTests.cs New single-asset class covering runsettings-driven timeout behavior.
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeCancellationTests.cs New single-asset class covering cooperative cancellation lifecycle timeout behavior.
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTestMethodTests.cs New single-asset class covering [Timeout(1000)] on test method scenarios.
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeTestMethodTests.cs New single-asset class covering [Timeout(1000, CooperativeCancellation = true)] on test method scenarios.

@Youssef1313 Youssef1313 requested a review from Evangelink March 20, 2026 11:38
@Evangelink Evangelink enabled auto-merge March 20, 2026 17:20
@Evangelink Evangelink merged commit 69b25ca into main Mar 20, 2026
15 checks passed
@Evangelink Evangelink deleted the copilot/fix-multiple-test-assets-issue branch March 20, 2026 17:20
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.

Avoid having multiple test assets in a single test class

4 participants