OrleansTestKit 8.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package OrleansTestKit --version 8.2.1                
NuGet\Install-Package OrleansTestKit -Version 8.2.1                
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.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OrleansTestKit --version 8.2.1                
#r "nuget: OrleansTestKit, 8.2.1"                
#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.1

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

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 6,155 10/5/2024
8.2.1 10,813 9/7/2024
8.2.0 10,757 7/19/2024
8.1.0 23,714 5/8/2024
8.0.0 17,722 1/7/2024
4.0.1 1,907 5/19/2024
4.0.0 6,845 1/7/2024
4.0.0-beta.3 19,859 7/25/2023
4.0.0-beta.2 9,638 5/21/2023
4.0.0-beta.1 10,267 2/6/2023
3.1.9 84,467 2/5/2023
3.1.8 340,669 12/30/2021
3.1.7 75,536 9/12/2021
3.1.6 16,728 8/3/2021
3.1.5 8,933 6/22/2021
3.1.4 50,396 12/15/2020
3.1.3 19,938 9/10/2020
3.1.2 10,730 7/3/2020
3.1.1 15,035 3/5/2020
3.1.0 854 3/4/2020
3.0.1 812 3/3/2020
3.0.0 11,919 10/25/2019
3.0.0-rc2 455 10/16/2019
3.0.0-rc1 413 10/15/2019
2.3.6 6,627 7/20/2019
2.3.5 2,098 6/14/2019
2.3.4 962 6/4/2019
2.3.3 648 6/2/2019
2.3.2 1,785 5/16/2019
2.3.1 1,775 4/2/2019
2.3.0 683 3/29/2019
2.0.0 9,727 4/17/2018
2.0.0-RC2 861 3/15/2018
2.0.0-beta4 1,158 12/27/2017
2.0.0-beta3 1,102 12/20/2017
0.1.4-beta3 802 12/20/2017
0.1.4-beta2 836 12/18/2017
0.1.4-beta 788 12/18/2017
0.1.3 1,900 9/22/2017
0.1.2 909 9/21/2017
0.1.1 1,209 5/3/2017
0.1.0 1,448 2/28/2017