Add NativeAOT xunit test runner with threaded execution#1560
Open
kotlarmilos wants to merge 2 commits intodotnet:mainfrom
Open
Add NativeAOT xunit test runner with threaded execution#1560kotlarmilos wants to merge 2 commits intodotnet:mainfrom
kotlarmilos wants to merge 2 commits intodotnet:mainfrom
Conversation
Introduce NativeAotXunitTestRunner that extends ThreadlessXunitTestRunner with parallel test execution support and file-based result output. ThreadlessXunitTestRunner uses reflection-based discovery (NativeAOT-safe) but forces single-threaded execution. The new runner overrides the configuration to allow parallel test collections since NativeAOT has threads available. - Add NativeAotXunitTestRunner extending ThreadlessXunitTestRunner with configurable MaxParallelThreads and ParallelizeTestCollections - Extract virtual CreateConfiguration() and RunnerDisplayName from ThreadlessXunitTestRunner for extensibility - Revert PR dotnet#1554 changes to ThreadlessXunitTestRunner, keeping it WASM-only as originally intended - Update iOS and Android entry points to use NativeAotXunitTestRunner when RuntimeFeature.IsDynamicCodeSupported is false Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
akoeplinger
reviewed
Mar 13, 2026
| /// Xunit test runner for NativeAOT environments. Extends ThreadlessXunitTestRunner | ||
| /// with parallel test execution support and file-based result output. | ||
| /// </summary> | ||
| internal class NativeAotXunitTestRunner : ThreadlessXunitTestRunner |
Member
There was a problem hiding this comment.
call this ReflectionBasedXunitTestRunner or something else that is not directly tied to NativeAOT
Member
There was a problem hiding this comment.
I think you could make this an abstract class CustomXunitTestRunner and then make ThreadlessXunitTestRunner and ReflectionBasedXunitTestRunner concrete implementations of that.
This would avoid the weird conceptual situation where ReflectionBasedXunitTestRunner derives from ThreadlessXunitTestRunner
…ectionBasedXunitTestRunner Address review feedback: - Rename NativeAotXunitTestRunner to ReflectionBasedXunitTestRunner - Extract shared reflection-based discovery logic into abstract CustomXunitTestRunner base class - Make ThreadlessXunitTestRunner and ReflectionBasedXunitTestRunner concrete implementations of CustomXunitTestRunner Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduce
NativeAotXunitTestRunnerthat extendsThreadlessXunitTestRunnerwith parallel test execution support and file-based result output.ThreadlessXunitTestRunneruses reflection-based discovery (NativeAOT-safe) but forces single-threaded execution. Since NativeAOT has threads available, the new runner overrides the configuration to allow parallel test collections.Changes
NativeAotXunitTestRunnerextendingThreadlessXunitTestRunnerwith configurableMaxParallelThreadsandParallelizeTestCollectionsCreateConfiguration()andRunnerDisplayNamefromThreadlessXunitTestRunnerfor extensibilityThreadlessXunitTestRunner, keeping it WASM-only as originally intended