SolidCode.CombinatorialTests.XUnit
1.1.0
dotnet add package SolidCode.CombinatorialTests.XUnit --version 1.1.0
NuGet\Install-Package SolidCode.CombinatorialTests.XUnit -Version 1.1.0
<PackageReference Include="SolidCode.CombinatorialTests.XUnit" Version="1.1.0" />
paket add SolidCode.CombinatorialTests.XUnit --version 1.1.0
#r "nuget: SolidCode.CombinatorialTests.XUnit, 1.1.0"
// Install SolidCode.CombinatorialTests.XUnit as a Cake Addin #addin nuget:?package=SolidCode.CombinatorialTests.XUnit&version=1.1.0 // Install SolidCode.CombinatorialTests.XUnit as a Cake Tool #tool nuget:?package=SolidCode.CombinatorialTests.XUnit&version=1.1.0
SolidCode.CombinatorialTests
Provides combinatorial test data for a test method written with xUnit and MSTest.
Description
This library is designed to simplify the process of generating combinatorial test data for test methods. Combinatorial testing is a technique that involves testing all possible combinations of input values to ensure comprehensive test coverage.
Installation
There are 2 different NuGet packages for xUnit and MSTest. You can install the one that fits your testing framework.
- package for xUnit:
SolidCode.CombinatorialTests.XUnit
- package for MSTest:
SolidCode.CombinatorialTests.MSTest
For example, you can install the SolidCode.CombinatorialTests.XUnit
library using the following command:
dotnet add package SolidCode.CombinatorialTests.XUnit
or via NuGet Package Manager in Visual Studio:
PM> Install-Package SolidCode.CombinatorialTests.XUnit
Usage
Usage is the same for xUnit and MSTest.
- Add the
[CombinatorialData]
attribute to the test method that has parameters to make it a combinatorial test method. - Specify a set of values for each parameter, or use the default set where supported and appropriate:
- There is no need to specify anything to use the default set of values for supported types (see the list of supported types below).
- Use the values attribute to specify a set of values if the type has no default set of values, or to provide your own set (see the list of available attributes below).
Supported attributes for specifying sets of values
[CombinatorialValues(params object?[] values)]
- Specifies a set of values for a parameter in a combinatorial test.[CombinatorialRangeValues<TNumber>(TNumber start, TNumber max, TNumber step)]
- Specifies a set of range-based values for a parameter in a combinatorial test.
NOTE: The .NET Standard 2.0 build implements a non-generic, limited version of this attribute.
[CombinatorialMemberValues(Type sourceType, string memberName)]
- Specifies a set of values for a parameter in a combinatorial test generated by the member of the specified type. If thesourceType
is not specified, the type of the current test class is used.
Example
[TestMethod]
[CombinatorialData]
public async Task SomeTestAsync(
[CombinatorialValues(7, 42, 255)]
uint id,
bool isActive,
[CombinatorialMemberValues(memberName: nameof(_raitingValues))]
Raiting rating,
[CombinatorialRange<uint>(start: 1, end: 10, step: 2)]
uint referenceId,
[CombinatorialRangeValues("comment 1", "comment 2", "comment 3")]
string comment)
{
// Test method body
}
Supported types with default sets of values:
Type | Default set |
---|---|
bool | false , true |
bool? | false , true , null |
byte | 0 , 1 |
byte? | 0 , 1 , null |
short | -1 , 0 , 1 |
short? | -1 , 0 , 1 , null |
int | -1 , 0 , 1 |
int? | -1 , 0 , 1 , null |
uint | 0U , 1U |
uint? | 0U , 1U , null |
long | -1L , 0L , 1L |
long? | -1L , 0L , 1L , null |
ulong | 0UL , 1UL |
ulong? | 0UL , 1UL , null |
float | -1f , 0f , 1f |
float? | -1f , 0f , 1f , null |
double | -1d , 0d , 1d |
double? | -1d , 0d , 1d , null |
decimal | -1m , 0m , 1m |
decimal? | -1m , 0m , 1m , null |
char | 'a' , 'z' |
char? | 'a' , 'z' , null |
License
This library is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.