SpawnDev.UnitTesting
2.3.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SpawnDev.UnitTesting --version 2.3.0
NuGet\Install-Package SpawnDev.UnitTesting -Version 2.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpawnDev.UnitTesting" Version="2.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpawnDev.UnitTesting" Version="2.3.0" />
<PackageReference Include="SpawnDev.UnitTesting" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpawnDev.UnitTesting --version 2.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SpawnDev.UnitTesting, 2.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpawnDev.UnitTesting@2.3.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpawnDev.UnitTesting&version=2.3.0
#tool nuget:?package=SpawnDev.UnitTesting&version=2.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NuGet
| Package | Description | Link |
|---|---|---|
| SpawnDev.UnitTesting | Cross-platform unit testing framework | |
| SpawnDev.UnitTesting.Blazor | Blazor UI components for SpawnDev.UnitTesting |
SpawnDev.UnitTesting
A lightweight, cross-platform unit testing framework for .NET. Works everywhere — Blazor WASM, WPF, Console, and more.
Supersedes SpawnDev.Blazor.UnitTesting with a platform-agnostic core.
Features
- Cross-platform — no Blazor, WPF, or browser dependencies in the core library
- Simple API —
[TestMethod]attribute andUnitTestRunnerfor reflection-based discovery - Async support — full
async Tasktest methods with configurable timeouts - Unsupported tests — throw
UnsupportedTestExceptionto skip tests gracefully - Blazor UI —
SpawnDev.UnitTesting.BlazorprovidesUnitTestsViewRazor component
Quick Start
1. Create test classes
using SpawnDev.UnitTesting;
public class MyTests
{
[TestMethod]
public async Task AdditionTest()
{
int result = 1 + 1;
if (result != 2) throw new Exception($"Expected 2, got {result}");
}
[TestMethod]
public async Task UnsupportedFeatureTest()
{
throw new UnsupportedTestException("Feature not available on this platform");
}
}
2. Run tests programmatically
var runner = new UnitTestRunner();
runner.SetTestTypes(new[] { typeof(MyTests) });
runner.TestStatusChanged += () => Console.WriteLine($"Progress: {runner.Tests.Count(t => t.State == TestState.Done)}/{runner.Tests.Count}");
await runner.RunTests();
3. Blazor UI (SpawnDev.UnitTesting.Blazor)
@using SpawnDev.UnitTesting.Blazor
<UnitTestsView TestAssemblies="_assemblies"></UnitTestsView>
@code {
IEnumerable<Assembly>? _assemblies = new List<Assembly> {
typeof(MyTests).Assembly
};
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
-
net8.0
NuGet packages (3)
Showing the top 3 NuGet packages that depend on SpawnDev.UnitTesting:
| Package | Downloads |
|---|---|
|
SpawnDev.UnitTesting.Blazor
Blazor UI components for SpawnDev.UnitTesting |
|
|
SpawnDev.UnitTesting.Desktop
WPF UI components for SpawnDev.UnitTesting. Desktop counterpart to SpawnDev.UnitTesting.Blazor. |
|
|
SpawnDev.UnitTesting.Browser
Browser UI components for SpawnDev.UnitTesting, built on SpawnJS (no Blazor interop dependency) |
GitHub repositories
This package is not used by any popular GitHub repositories.