Repository navigation
spike: Metalama.Testing.AspectTesting beside xunit.v3 on MTP - #105
Merged
Merged
Conversation
Metalama.Testing.AspectTesting 2026.1.30 tests the real generators, internal aspects and TransitiveProjectFabric included, through a project reference. It runs on xunit v2 and VSTest, so it stays out of the solution's test run. - It runs as a project of its own with its own global.json, which keeps the SDK pin and drops the test key. `dotnet test` from the spike folder passes 4 of 4. From the root, the MTP selection refuses it. - In a scratch .slnx, one VSTest project makes `dotnet test --solution` refuse the whole run, so no other test runs. IsTestProject=false hides it from that run, but then VSTest's `dotnet test` also runs nothing and exits 0. - `dotnet vstest` on the built dll runs it from anywhere. CI would need one more step, which was not run. - A seeded defect in a scratch copy of src/ fails the two snapshots whose output it changes. - Plain, validated and closed-set shapes give 235 to 349 lines each. They are formatted but fully qualified, so they suit a review per member, not per file. - Reading them showed dead code after the return in every generated TryParse(string?): TryParseTemplate's meta.InsertStatement calls are still emitted after a compile-time return. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #93
Problem
Gaël Fraiteur of Metalama suggested
Metalama.Testing.AspectTesting(discussion 2305): its tests compare the transformed code with a stored file, so a reviewer can check the output instead of the generator. The package runs on xunit v2, and this repository on xunit.v3 under Microsoft Testing Platform.Change
spikes/AspectTestingSpike: an xunit v2 / VSTest project with its ownglobal.jsonandDirectory.Build.props, referencing the realsrc/CodoMetis.TypeKit.Generators. It has four cases:OrderId,Email,OrderStatus, and a refusal (CMTK1002). The README holds the question, the answer and 16 measured findings.The answer:
src/failed the two cases it touches, with 7 changed lines.dotnet test --solutionrefuse the whole run. The workaround,IsTestProject=false, runs nothing and exits 0.Decision: not adopted. The way the generators are tested does not change, so no decision record. The spike stays as the record. Reading its output found dead code in every generated
TryParse(#100).Tests
dotnet test AspectTests/AspectTests.csproj(VSTest, through the folder'sglobal.json): 4 passed.🤖 Generated with Claude Code