Improve integration testing system with new layout and domain-specific assertions#657
Merged
Conversation
epszaw
approved these changes
Jun 3, 2026
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.
Summary
This PR overhauls the integration testing infrastructure and migrates NUnit/Xunit integration tests to a generated, domain-specific assertion DSL for Allure results.
tests/Allure.NUnit.Tests(layout migration + assertion transition)tests/Allure.Xunit.Tests(layout migration + assertion transition)tests/Allure.Testing(new assertion/model engine)build/Allure.Build.SourceGeneratorsandbuild/Allure.Build.Tasks(codegen/tasking for samples + assertions)What Changed
1) New integration-test layout and sample metadata flow
Allowed samples to be nested inside a test project. This allows moving from the overblown
Samplesdirectory with all the samples of the project to multiple test-specific samples packed next to the test classes.Samples are automatically detected in any
Samplesfolder at any level inside the project. The new naming reflects that: sample projects are named<test-project>.Samples.<parent-folders>.<sample-name>, where<sample-nameis the name of the sample file (without extension) or the name of the sample directory insideSamples.The registry generator now creates one registry class per
Samplesdirectory. The class is created in the namespace that containsSamples. Test classes within this namespace can useAllureSampleRegistrydirectly.Reorganized tests into domain folders (
AllureIds,BddLabels,Links,Fixtures,Tags, etc.) for both NUnit and Xunit.Moved sample property resolution from
.propsand.targetsfiles to the newFillSampleMetadatabuild task. The task resolves the following sample properties:SampleNameRegistryNamespaceProjectName/ProjectFilePath/ProjectRelativePathResultsDirectoryProjectBinPath/ProjectObjPathUpdated test targets to build and consume the build task assembly (
Allure.Build.Tasks.dll) from its original output locationNet effect: sample generation/execution is less convention-fragile and better aligned with nested folder layouts.
2) Sample registry generation redesign
AllureSampleRegistryGeneratornow groups byRegistryNamespaceandSampleNameinstead of only a project suffix.Samples.allure-resultsdirectoryNet effect: stronger test partitioning and more user-friendly sample hints.
3) New generated custom assertion system for Allure results
Added typed Allure result model in
tests/Allure.Testing/Assertions/Model/*and property marker interfaces under.../Model/Properties/*.Added assertion primitives in
tests/Allure.Testing/Assertions/*for:Added source generator templates/metadata (
build/Allure.Build.SourceGenerators/Assertions/*) to derive assertion surface from model/property metadata and interfaces.Added assertion API in
tests/Allure.Testing/AllureAssertionExtensions.csfor:Added source-generated assertion API in
tests/Allure.Testing/AllureAssertionExtensions.csfor:Net effect: integration tests now assert semantic Allure structures with domain language instead of manual JSON traversal.
4) Result parsing hardening in sample runner
AllureSampleRunnernow parses JSON into typed model objects (AllureTestResult,AllureContainer, etc.) and aggregates parse/validation failures.AllureResultsJSON-object record and replaced with typed model-backed results.Net effect: clearer failures when the sample output shape is invalid.
5) Tooling/runtime alignment updates
.NET 10andC# 14(Directory.Build.props, workflow update).1.35.2(TUnit,TUnit.Core,TUnit.Assertions).IsTestProject=falseand removedTestContainercapability forsrc/*projects to avoid accidental test discovery in IDE/CLI for non-test projects.Custom Assertions Added (with examples)
The new DSL is generated, so assertions are consistent across Allure model objects and collections.
Root/result-level assertions
Use to assert
AllureResults.HasSingleTestResult(...): narrows to the found test result.HasTestResultAt(...): narrows to the test result at a specific index.HasTestResult(...): at least one test result.HasOnlyOneTestResult(...): exactly one test result.HasNoTestResult(...): no test result.HasTestResults([...]): matching all test results.HasSingleContainer(...): narrows to the found container.HasContainerAt(...): narrows to the container at a specific index.HasContainer(...): at least one container.HasOnlyOneContainer(...): exactly one container.HasNoContainer(...): no container.HasContainer([...]): matching all containers.Example:
Property assertions (existence/value/absence)
Use to assert Allure Model objects (like
AllureTestResultorAllureLabel):Has<Property>(): narrows to the property value if it exists.HasNo<Property>(): for properties that must be missing.Has<Property>(...): checks for equality/constraints.Or chain them via
.That:.That.Has<Property>().That.HasNo<Property>().That.Has<Property>(...)Alternatively, chain them, via
With(omit theHasprefix):.With.<Property>().With.No<Property>().With.<Property>(...)Example:
Collection assertions
Use to assert collections and collection properties like
labels:HasSingle<Item>(...): narrows to the found item.Has<Item>At(...): narrows to the item at a specific index.HasOnlyOne<Item>(...): exactly one item.Has<Item>(...): at least one item.HasNo<Item>(...): no item.When asserting collection properties, you can chain them via
.Thatand.Withas with other property assertions.Example:
Other changes and fixes
Allure_GenerateTestSamplesnow deletes existing sample files that have been removed from the source.Allure_DeleteTestSamplesnow correctly deletes project output (bin) and intermediate output (obj) directories.Allure_DeleteTestSamplesalso removes all directories frombinandobjthat match the<test-project>.Samples.*pattern. This allows for a proper cleanup of removed samples.Allure_GenerateTestSamplesnow correctly initializes required properties when run directly.AllureSampleRegistryGeneratorto a new MSBuild task.Migration Notes
FillSampleMetadata.