StirlingLabs.Tests
23.3.3
Prefix Reserved
See the version list below for details.
dotnet add package StirlingLabs.Tests --version 23.3.3
NuGet\Install-Package StirlingLabs.Tests -Version 23.3.3
<PackageReference Include="StirlingLabs.Tests" Version="23.3.3" />
paket add StirlingLabs.Tests --version 23.3.3
#r "nuget: StirlingLabs.Tests, 23.3.3"
// Install StirlingLabs.Tests as a Cake Addin #addin nuget:?package=StirlingLabs.Tests&version=23.3.3 // Install StirlingLabs.Tests as a Cake Tool #tool nuget:?package=StirlingLabs.Tests&version=23.3.3
StirlingLabs.Tests is a lightweight test framework built for simplicity. It's designed to be easy to use, with a minimalistic approach to testing that focuses on simplicity and ease-of-use.
Features
- Lightweight and easy to use
- No need for attributes or class decorations
- Injection of
this
pointer,TextWriter
for logging, andCancellationToken
for test cancellation signal via method parameters - Classes must be sealed and in a namespace that ends with
.Tests
or have a class name that ends withTests
- Class default constructors act as
SetUp
equivalents - Static class constructors act as
OneTimeSetUp
equivalents
Getting Started
To get started with StirlingLabs.Tests, simply install the NuGet package and add a reference to your test project. Then, define your tests as methods within a sealed class, in a namespace that ends with .Tests
or has a class name that ends with Tests
. Test methods may not be static.
namespace MyProject.Tests
{
public sealed class MyTests
{
static MyTests()
{
// OneTimeSetUp equivalent
}
public MyTests()
{
// SetUp equivalent
}
public void MyTest1()
{
// test code
}
public void MyTest2(TextWriter logger)
{
// test code with logging
}
public void MyTest3(CancellationToken cancellationToken)
{
// test code with cancellation
}
public void MyTest4(TextWriter logger, CancellationToken cancellationToken)
{
// test code with logging and cancellation
}
}
}
Note that the parameters must be in the order specified, and may not be out of order.
The test method names must also be unique within the class. If you have multiple tests with the same name, you will get an error related to ambiguous method naming.
You can then run your tests using the built-in test runner, like this:
dotnet test MyProject.sln
Contributing
We welcome contributions from the community! If you find a bug or have a feature request, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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 was computed. 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. |
-
net6.0
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.5.0)
- Microsoft.NET.Test.Sdk (>= 17.5.0)
- Microsoft.TestPlatform.ObjectModel (>= 17.5.0)
-
net7.0
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.5.0)
- Microsoft.NET.Test.Sdk (>= 17.5.0)
- Microsoft.TestPlatform.ObjectModel (>= 17.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.