Skip to content

Add NativeAOT xunit test runner with threaded execution#1560

Merged
kotlarmilos merged 3 commits intodotnet:mainfrom
kotlarmilos:feature/native-aot-test-runner
Mar 17, 2026
Merged

Add NativeAOT xunit test runner with threaded execution#1560
kotlarmilos merged 3 commits intodotnet:mainfrom
kotlarmilos:feature/native-aot-test-runner

Conversation

@kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Mar 13, 2026

Description

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. Since NativeAOT has threads available, the new runner overrides the configuration to allow parallel test collections.

Changes

  • Add NativeAotXunitTestRunner extending ThreadlessXunitTestRunner with configurable MaxParallelThreads and ParallelizeTestCollections
  • Extract virtual CreateConfiguration() and RunnerDisplayName from ThreadlessXunitTestRunner for extensibility
  • Revert Enable NativeAOT support for iOS test runner #1554 changes to ThreadlessXunitTestRunner, keeping it WASM-only as originally intended

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>
kotlarmilos and others added 2 commits March 13, 2026 16:00
…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>
@kotlarmilos kotlarmilos requested a review from akoeplinger March 16, 2026 12:23
@kotlarmilos
Copy link
Member Author

@akoeplinger Updated, please take a look

@kotlarmilos kotlarmilos merged commit f3b160f into dotnet:main Mar 17, 2026
17 checks passed
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.

2 participants