TestInheritanceGenerator 1.1.0
dotnet add package TestInheritanceGenerator --version 1.1.0
NuGet\Install-Package TestInheritanceGenerator -Version 1.1.0
<PackageReference Include="TestInheritanceGenerator" Version="1.1.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add TestInheritanceGenerator --version 1.1.0
#r "nuget: TestInheritanceGenerator, 1.1.0"
// Install TestInheritanceGenerator as a Cake Addin #addin nuget:?package=TestInheritanceGenerator&version=1.1.0 // Install TestInheritanceGenerator as a Cake Tool #tool nuget:?package=TestInheritanceGenerator&version=1.1.0
InheritedTestsGenerator
Purpose
This source generator package generates test class "stubs" which inherit from test classes in a referenced test project. The typical use case is if you have test projects per version of some software component and you want all tests for the previous version to be executed for the next version as well. This is accomplished automatically by this package by generating a file for each found test class in the referenced test project and by adding inheritance to the original class.
Usage
Add a reference to this nuget package in the package you want to inherit test into and also reference the test project for the previous version.
It is possible to disable inheritance generation for specific test classes by adding an attribute called SkipInheritanceGenerationAttribute. This attribute can be added in the test project where it is needed, as long as it has that specific name. It is also available in a NuGet package called TestInheritanceGenerator.Annotations.
Supported test frameworks
The package has support for the following test frameworks:
- MSTest
- xUnit
- NUnit
Analyzers
The following diagnostics are reported as guidance, if no tests are being generated:
- TestInherit001 - Incorrect assembly name
- TestInherit002 - No base assembly
- TestInherit003 - No tests in base assembly
Credits
This work is heavily inspired by a similar source generator implemented by Sam Harwell in StyleCop.Analyzers.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.0 | 177 | 11/28/2024 |
1.1.0-alpha.1 | 40 | 11/28/2024 |
1.0.0 | 132 | 11/24/2024 |