OrleansTestKit 8.2.2

dotnet add package OrleansTestKit --version 8.2.2                
NuGet\Install-Package OrleansTestKit -Version 8.2.2                
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="OrleansTestKit" Version="8.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OrleansTestKit --version 8.2.2                
#r "nuget: OrleansTestKit, 8.2.2"                
#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.
// Install OrleansTestKit as a Cake Addin
#addin nuget:?package=OrleansTestKit&version=8.2.2

// Install OrleansTestKit as a Cake Tool
#tool nuget:?package=OrleansTestKit&version=8.2.2                

Orleans TestKit

GitHub build status NuGet stable package version MIT license Discord

About

The Orleans TestKit is a community-maintained library providing mock objects that facilitate unit testing grains in applications built on the Microsoft Orleans framework. It provides a simulated grain activation context, leveraging Moq to generate test doubles for dependencies such as persistent state, reminders, timers, and streams. By simulating a grain activation context, you focus on testing the behavior of a single grain in isolation.

The official integration testing approach leverages the TestCluster. The TestCluster is a fully functional, in-memory cluster. It is faster to start than a regular cluster and provides a complete runtime. However, it may require complex configuration and custom-developed dependencies to test particular scenarios. That having been said, there are important caveats to the Orleans TestKit approach.

The simulated grain activation context does not provide the single-threaded execution model of the Microsoft Orleans runtime. It is up to you to ensure the grain activation is used appropriately. Unfortunately, this may result in abnormal method execution or behaviors that are impossible to reproduce, especially in reentrant grains.

It is also important to note that mock-based testing presents risk of coupling your test cases to the internal implementation details of the grain. This may make your code difficult to refactor and your tests brittle (see Martin Fowler's article Mocks Aren't Stubs).

It is recommended that you consider developing a mixture of tests based on both the Orleans TestKit and the TestCluster.

Getting Started

There are three branches and major versions of the Orleans TestKit. The main branch provides Orleans TestKit 8, a stable version supporting Orleans 8. The 4.x branch provides Orleans TestKit 4, a stable version supporting Microsoft Orleans 7 (during development, it was known as Orlean 4). The 3.x branch provides Orleans TestKit 3, a stable version supporting Microsoft Orleans 3.

If you are using Microsoft Orleans 8, install the latest, stable OrleansTestKit NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console:

Install-Package OrleansTestKit

If you are using Microsoft Orleans 7, install the latest, stable version less than 8.0 of the OrleansTestKit NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console, replacing 4.x.x with the latest version of the NuGet package less than 8.0:

Install-Package OrleansTestKit -Version 4.x.x

If you are using Microsoft Orleans 3, install the latest, stable version less than 4.0 of the OrleansTestKit NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console, replacing 3.x.x with the latest version of the NuGet package less than 4.0:

Install-Package OrleansTestKit -Version 3.x.x

Refer to the unit tests project to learn how to create test fixtures using the Orleans TestKit.

Contributing

Either Visual Studio or Visual Studio Code may be used for development. Visual Studio provides a richer experience, especially when it comes to debugging. Visual Studio Code providers a lightweight experience and still works with the majority of the tooling.

Visual Studio

  1. In Visual Studio, open the OrleansTestKit.sln solution.

  2. Recommended: Install the CodeMaid extension.

Visual Studio Code

  1. In Visual Studio Code, open the folder containing the OrleansTestKit.sln solution file.

  2. Recommended: Open Visual Studio Code's extensions panel, and install all of the recommended extensions.

Community

  • Chat about all things Orleans on the official Discord server.
  • Report bugs and ask questions about the Orleans TestKit by opening a new GitHub Issue. Please be sure to note which version of the Orleans TestKit you are using.

License

This project is released under the MIT license.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on OrleansTestKit:

Package Downloads
Blauhaus.EVACS.TestHelpers.Server

Package Description

Blauhaus.Orleans.TestHelpers

Package Description

Cratis.Applications.Orleans.Specs

Package Description

Cratis.Chronicle.Grains.Specs

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on OrleansTestKit:

Repository Stars
PiotrJustyna/road-to-orleans
This repository illustrates the road to orleans with practical, real-life examples. From most basic, to more advanced techniques.
Version Downloads Last updated
8.2.2 11,992 10/5/2024
8.2.1 12,586 9/7/2024
8.2.0 11,338 7/19/2024
8.1.0 24,753 5/8/2024
8.0.0 18,231 1/7/2024
4.0.1 2,120 5/19/2024
4.0.0 6,892 1/7/2024
4.0.0-beta.3 20,083 7/25/2023
4.0.0-beta.2 9,746 5/21/2023
4.0.0-beta.1 10,269 2/6/2023
3.1.9 86,875 2/5/2023
3.1.8 341,404 12/30/2021
3.1.7 75,723 9/12/2021
3.1.6 16,782 8/3/2021
3.1.5 8,938 6/22/2021
3.1.4 50,419 12/15/2020
3.1.3 20,022 9/10/2020
3.1.2 10,745 7/3/2020
3.1.1 15,144 3/5/2020
3.1.0 858 3/4/2020
3.0.1 816 3/3/2020
3.0.0 11,927 10/25/2019
3.0.0-rc2 457 10/16/2019
3.0.0-rc1 415 10/15/2019
2.3.6 6,631 7/20/2019
2.3.5 2,151 6/14/2019
2.3.4 972 6/4/2019
2.3.3 652 6/2/2019
2.3.2 1,793 5/16/2019
2.3.1 1,779 4/2/2019
2.3.0 687 3/29/2019
2.0.0 9,734 4/17/2018
2.0.0-RC2 863 3/15/2018
2.0.0-beta4 1,160 12/27/2017
2.0.0-beta3 1,104 12/20/2017
0.1.4-beta3 804 12/20/2017
0.1.4-beta2 838 12/18/2017
0.1.4-beta 790 12/18/2017
0.1.3 1,926 9/22/2017
0.1.2 913 9/21/2017
0.1.1 1,213 5/3/2017
0.1.0 1,461 2/28/2017