Skip to content

feat: move framework adapters to source generation#810

Merged
vbreuss merged 6 commits intomainfrom
topic/move-frameworks-to-source-generator
Oct 14, 2025
Merged

feat: move framework adapters to source generation#810
vbreuss merged 6 commits intomainfrom
topic/move-frameworks-to-source-generator

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Oct 14, 2025

This PR moves framework adapters from traditional hand-written code to source generation. The goal is to improve maintainability and reduce manual implementation overhead by automatically generating framework-specific adapters based on detected testing frameworks.

Key changes:

  • Introduces a new aweXpect.Frameworks source generator project
  • Removes manual framework adapter implementations and replaces them with generated code
  • Updates test project references to use the new source generator

@vbreuss vbreuss self-assigned this Oct 14, 2025
Copilot AI review requested due to automatic review settings October 14, 2025 07:38
@vbreuss vbreuss added the enhancement New feature or request label Oct 14, 2025
Copy link
Copy Markdown

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

This PR moves framework adapters from traditional hand-written code to source generation. The goal is to improve maintainability and reduce manual implementation overhead by automatically generating framework-specific adapters based on detected testing frameworks.

  • Introduces a new aweXpect.Frameworks source generator project
  • Removes manual framework adapter implementations and replaces them with generated code
  • Updates test project references to use the new source generator

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
aweXpect.sln Adds new framework generator project and renames test projects to include "Adapter" suffix
Source/aweXpect.Frameworks/* New source generator project that detects testing frameworks and generates appropriate adapters
Source/aweXpect.Core/Core/Adapters/* Removes manual adapter implementations for all testing frameworks
Tests/**/*.csproj Adds references to the new framework generator and updates project names
Tests/**/namespace updates Updates namespaces to reflect new "Adapter" naming convention

Comment thread Source/aweXpect.Frameworks/FrameworkGenerator.cs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 14, 2025

Test Results

    10 files   -    28      10 suites   - 28   4m 58s ⏱️ +9s
16 758 tests  - 1 230  16 757 ✅  - 1 229  1 💤  - 1  0 ❌ ±0 
47 016 runs   - 3 585  47 015 ✅  - 3 584  1 💤  - 1  0 ❌ ±0 

Results for commit 23e38ae. ± Comparison against base commit 258d43f.

This pull request removes 2737 and adds 1507 tests. Note that renamed tests count towards both.
aweXpect.Core.Api.Tests.ApiAcceptance ‑ AcceptApiChanges()
aweXpect.Core.Api.Tests.ApiApprovalTests ‑ VerifyPublicApiForAweXpectCore("net8.0")
aweXpect.Core.Api.Tests.ApiApprovalTests ‑ VerifyPublicApiForAweXpectCore("netstandard2.0")
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ FromType_WhenNameDoesNotExist_ShouldReturnNull
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ Inconclusive_MissingAssemblyName_ShouldThrowNotSupportedException
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ Inconclusive_ValidAssemblyName_ShouldThrowNotSupportedException
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ Inconclusive_ValidAssemblyName_WithException_ShouldThrowProvidedException
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ MissingAssemblyName_ShouldNotBeAvailable
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ Skip_MissingAssemblyName_ShouldThrowNotSupportedException
aweXpect.Core.Tests.Core.Adapters.TestFrameworkAdapterTests ‑ Skip_ValidAssemblyName_ShouldThrowNotSupportedException
…
aweXpect.Internal.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore9106fcfe-bddd-49b9-b33b-ec28cf7b34b1")
aweXpect.Internal.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore95e06aa2-bea5-4cc4-8342-178bfdde9905")
aweXpect.Internal.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnorecffc5db7-5681-4ebc-a28f-728c4c487360")
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncTaskValue(value: 185)
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncTaskValue(value: 246)
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncTaskValue(value: 39)
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncValue(value: 104)
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncValue(value: 62)
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncValue(value: 9)
aweXpect.Internal.Tests.ThatTests.DelegateTests ‑ ShouldReturnValue_FuncValueTaskValue(value: 32)
…

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 14, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.14.0, Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.414
[Host] : .NET 8.0.20 (8.0.2025.41914), X64 RyuJIT AVX2

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

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 279.7 ns 1.50 ns 1.26 ns 0.0424 - 712 B
Bool_FluentAssertions 265.7 ns 2.48 ns 2.19 ns 0.0567 - 952 B
Bool_TUnit 219.8 ns 0.92 ns 0.86 ns 0.0396 - 664 B
Equivalency_aweXpect 311,215.1 ns 1,474.40 ns 1,379.15 ns 20.0195 0.9766 335556 B
Equivalency_FluentAssertions 2,280,486.2 ns 22,014.77 ns 20,592.63 ns 273.4375 46.8750 4584416 B
Equivalency_TUnit 294,686.7 ns 900.98 ns 798.70 ns 13.1836 0.4883 224760 B
Int_GreaterThan_aweXpect 283.1 ns 1.71 ns 1.60 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 277.4 ns 2.41 ns 2.14 ns 0.0730 - 1224 B
Int_GreaterThan_TUnit 241.4 ns 1.70 ns 1.59 ns 0.0486 - 816 B
ItemsCount_AtLeast_aweXpect 513.5 ns 3.59 ns 3.36 ns 0.0868 - 1464 B
ItemsCount_AtLeast_FluentAssertions 513.1 ns 3.98 ns 3.72 ns 0.1192 - 2008 B
ItemsCount_AtLeast_TUnit 18,654.3 ns 102.87 ns 96.22 ns 1.4954 - 25432 B
String_aweXpect 511.6 ns 3.59 ns 3.36 ns 0.0734 - 1232 B
String_FluentAssertions 519.2 ns 3.83 ns 3.58 ns 0.1287 - 2168 B
String_TUnit 273.5 ns 1.65 ns 1.47 ns 0.0496 - 832 B
StringArray_aweXpect 2,000.5 ns 14.40 ns 13.47 ns 0.1717 - 2888 B
StringArray_FluentAssertions 1,390.8 ns 15.36 ns 14.37 ns 0.2480 - 4152 B
StringArray_TUnit 737.3 ns 4.51 ns 4.00 ns 0.0820 - 1376 B
StringArrayInAnyOrder_aweXpect 2,585.0 ns 14.28 ns 13.36 ns 0.1831 - 3080 B
StringArrayInAnyOrder_FluentAssertions 128,636.1 ns 309.48 ns 274.35 ns 3.4180 - 61723 B
StringArrayInAnyOrder_TUnit 793.6 ns 3.15 ns 2.79 ns 0.0858 - 1440 B

Copilot AI review requested due to automatic review settings October 14, 2025 12:26
Copy link
Copy Markdown

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

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Comment thread Source/aweXpect.Frameworks/FrameworkGenerator.cs Outdated
@vbreuss vbreuss force-pushed the topic/move-frameworks-to-source-generator branch from 17157f8 to c1f8249 Compare October 14, 2025 13:00
Copilot AI review requested due to automatic review settings October 14, 2025 13:29
@vbreuss vbreuss force-pushed the topic/move-frameworks-to-source-generator branch from c1f8249 to bf54651 Compare October 14, 2025 13:29
Copy link
Copy Markdown

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

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

Copilot AI review requested due to automatic review settings October 14, 2025 13:49
Copy link
Copy Markdown

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

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

@github-actions
Copy link
Copy Markdown
Contributor

👽 Mutation Results

Mutation testing badge

aweXpect

Details
File Score Killed Survived Timeout No Coverage Ignored Compile 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 Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

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

@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss merged commit 0b4a83e into main Oct 14, 2025
14 checks passed
@vbreuss vbreuss deleted the topic/move-frameworks-to-source-generator branch October 14, 2025 17:26
@github-actions
Copy link
Copy Markdown
Contributor

This is addressed in release v2.27.0.

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

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants