Skip to content

refactor!: discover the test framework adapter only from the registry - #1066

Merged
vbreuss merged 1 commit into
mainfrom
refactor/retire-adapter-scan
Sep 13, 2026
Merged

vbreuss merged 1 commit into
mainfrom
refactor/retire-adapter-scan

Conversation

@vbreuss

@vbreuss vbreuss commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Scanning every loaded assembly was the last reflection on the initialization path: the candidate types are instantiated via Activator.CreateInstance, which trimming and Native AOT cannot preserve.

Target frameworks without ModuleInitializerAttribute keep scanning, because the generated adapter cannot register itself there, and they can neither be trimmed nor published with Native AOT.

The aweXpect pin moves to the pre-release whose generator emits the registration, so aweXpect.Core.Tests compiles outside Debug again and the build no longer needs the CoreOnly scope.

BREAKING CHANGE:
a hand-written ITestFrameworkAdapter is no longer discovered on net8.0 or later and has to be registered with TestFrameworkRegistry.Register.

@vbreuss vbreuss self-assigned this Sep 13, 2026
@vbreuss vbreuss added the breaking change The changes require a new major version label Sep 13, 2026
@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    7 files   -     43      7 suites   - 43   1m 40s ⏱️ - 8m 58s
1 479 tests  - 19 238  1 478 ✅  - 19 237  1 💤  - 1  0 ❌ ±0 
8 230 runs   - 99 544  8 229 ✅  - 99 543  1 💤  - 1  0 ❌ ±0 

Results for commit 12a43c9. ± Comparison against base commit f2e2904.

This pull request removes 19364 and adds 126 tests. Note that renamed tests count towards both.
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenAwaited_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenAwaited_WithoutReturnValue_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenNotAwaited_ShouldBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenNotAwaited_WithoutReturnValue_ShouldBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenNotAwaited_WithoutReturnValue_WithVerifyInMethod_ShouldStillBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedStatically_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedStatically_WithoutReturnValue_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedWithStaticUsing_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedWithStaticUsing_WithoutReturnValue_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerified_ShouldNotBeFlagged
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message034db111-3e1c-4598-b515-cb0e7c5ff4f2")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message18e5d5ee-ce4e-4826-bdfa-e111632def05")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message46f54b75-7bf0-4b6f-83b3-13b5a2a9b3fb")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messagec2922e70-4aa5-41cf-a9fa-56572eefa4f8")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messagee9960d32-deae-42de-aa77-abf5b5481347")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messagef2db9e10-6f1b-48e5-ae47-ecc7c12e8578")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message0254bee1-181d-4612-9212-bf5c9d278a91")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message7502c23e-b997-4d9d-8882-cda214f7e083")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message85dc2d45-493b-41b6-be8b-ce96b566cd74")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messageba1e111a-3842-402f-b90f-b0a42835526b")
…

♻️ This comment has been updated with latest results.

@vbreuss
vbreuss force-pushed the refactor/retire-adapter-scan branch from 4e4067f to 12a43c9 Compare September 13, 2026 13:37
Scanning every loaded assembly was the last reflection on the initialization path: the candidate types are instantiated via `Activator.CreateInstance`, which trimming and Native AOT cannot preserve.

Target frameworks without `ModuleInitializerAttribute` keep scanning, because the generated adapter cannot register itself there, and they can neither be trimmed nor published with Native AOT.

The `aweXpect` pin moves to the pre-release whose generator emits the registration, so `aweXpect.Core.Tests` compiles outside `Debug` again and the build no longer needs the `CoreOnly` scope.

BREAKING CHANGE: a hand-written `ITestFrameworkAdapter` is no longer discovered on net8.0 or later and has to be registered with `TestFrameworkRegistry.Register`.
@vbreuss
vbreuss force-pushed the refactor/retire-adapter-scan branch from 12a43c9 to 63b3d3c Compare September 13, 2026 14:34
@vbreuss
vbreuss enabled auto-merge (squash) September 13, 2026 14:37
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss disabled auto-merge September 13, 2026 14:46
@vbreuss
vbreuss merged commit d2ca3fb into main Sep 13, 2026
11 checks passed
@vbreuss
vbreuss deleted the refactor/retire-adapter-scan branch September 13, 2026 14:46
@github-actions

Copy link
Copy Markdown
Contributor

👽 Mutation Results

Mutation testing badge

aweXpect

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Runtime Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

aweXpect.Core

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Runtime Errors Total Detected Total Undetected Total Mutants
Core/Initialization/AweXpectInitialization.cs 87.50% 14 2 0 0 14 1 0 14 2 31

The final mutation score is 87.50%

Coverage Thresholds: high:80 low:60 break:0

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.5 LTS (Noble Numbat)
Intel Xeon 6973P-C 4.20GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
[Host] : .NET 8.0.31 (8.0.31, 8.0.3126.42015), X64 RyuJIT x86-64-v4

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 180.9 ns 4.82 ns 4.50 ns 0.0081 - 696 B
Bool_FluentAssertions 187.6 ns 8.90 ns 8.33 ns 0.0112 - 952 B
Equivalency_aweXpect 208,610.1 ns 4,708.43 ns 4,404.27 ns 3.9063 - 335442 B
Equivalency_FluentAssertions 1,456,289.7 ns 32,648.12 ns 27,262.66 ns 56.6406 9.7656 4841611 B
Int_GreaterThan_aweXpect 193.6 ns 6.33 ns 5.92 ns 0.0103 - 864 B
Int_GreaterThan_FluentAssertions 201.4 ns 10.13 ns 9.48 ns 0.0145 - 1224 B
ItemsCount_AtLeast_aweXpect 327.5 ns 8.40 ns 7.45 ns 0.0162 - 1360 B
ItemsCount_AtLeast_FluentAssertions 359.0 ns 9.71 ns 8.10 ns 0.0238 - 2008 B
String_aweXpect 299.3 ns 5.75 ns 5.38 ns 0.0134 - 1128 B
String_FluentAssertions 848.1 ns 12.47 ns 10.41 ns 0.0467 - 3944 B
StringArray_aweXpect 1,046.0 ns 26.27 ns 21.94 ns 0.0305 - 2624 B
StringArray_FluentAssertions 978.3 ns 13.89 ns 11.60 ns 0.0496 - 4152 B
StringArrayInAnyOrder_aweXpect 1,421.9 ns 44.86 ns 41.96 ns 0.0324 - 2816 B
StringArrayInAnyOrder_FluentAssertions 13,211.8 ns 284.55 ns 252.25 ns 0.3967 - 33465 B

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

Labels

breaking change The changes require a new major version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant