CheckOps
Shouldly
Shouldly is a BSD-3-Clause .NET assertion library focused on readable code and great failure messages that include the source expression being tested.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Shouldly is an assertion framework for .NET whose main idea is better failure messages. When map.IdOnDisk.ShouldBe(1) fails, Shouldly prints the actual source code of the assertion, for example “map.IdOnDisk should be 1 but was 2”, instead of a generic “expected 1 but was 2”. That makes failures understandable without opening the test.
Assertions are extension methods such as ShouldBe, ShouldNotBeNull, ShouldContain, ShouldBeEmpty, ShouldBeGreaterThan, ShouldStartWith, ShouldThrow<T>() and ShouldThrowAsync<T>(). ShouldSatisfyAllConditions groups several checks and reports all failures, and ShouldMatchApproved supports approval-style tests that compare output against an approved file. Shouldly is a lighter, permissively licensed alternative to Fluent Assertions, and has drawn renewed interest since that library’s licence change. The latest release is 4.3.0 (23 January 2025), with ongoing commits in November 2026.
The source code is at shouldly/shouldly on GitHub under the BSD-3-Clause licence, with about 3,400 stars; the most recent commit was on 11 November 2026.
Features
- Source-aware messages: Failures show the expression being asserted.
- Simple API:
ShouldBe,ShouldContain,ShouldThrowand more. - Grouped conditions:
ShouldSatisfyAllConditions. - Approval testing:
ShouldMatchApprovedfor output snapshots.
Pros
- Free to use: Open source under the BSD-3-Clause licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 11 November 2026.
- Community: About 3,400 GitHub stars.
Cons
- Smaller API than Fluent Assertions: Fewer specialised assertions for complex graphs.
- Release cadence: The last tagged release is from January 2025.
Usage and Links (Example)
using Shouldly;
[Fact]
public void CalculatesTotals()
{
var cart = new Cart();
cart.Add(new Item("apple", 2));
cart.Total.ShouldBe(2);
cart.Items.ShouldContain(i => i.Name == "apple");
Should.Throw<InvalidOperationException>(() => cart.Checkout(paymentMethod: null));
}
Resources:
Pricing
Shouldly is free and open source under the BSD-3-Clause licence.
Recommended for?
- .NET teams wanting clear failure messages with a simple, permissive library.
- Teams moving away from Fluent Assertions because of licensing.
Conclusion
Shouldly delivers simple assertions with some of the most helpful failure messages in .NET, under a permissive licence.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Shouldly side by side.
FFluent AssertionsFluent Assertions is a .NET assertions library with natural-language `Should()` syntax; versions 8 and later are free for open-source and non-commercial use but require a paid licence (via Xceed) for commercial use.Compare with Shouldly
XxUnit.netxUnit.net is a free, Apache-2.0, community-focused unit testing tool for C#, F# and Visual Basic, part of the .NET Foundation; v3 supports .NET 8+ and .NET Framework 4.7.2+.Compare with Shouldly
NNUnitNUnit is an MIT-licensed unit-testing framework for all .NET languages on Windows, macOS and Linux, broad and non-opinionated, now at version 5 after NUnit 3 and 4.Compare with Shouldly
MMSTestMSTest is Microsoft's MIT-licensed test framework for .NET, developed in the microsoft/testfx repository alongside Microsoft.Testing.Platform, a lightweight alternative to VSTest, with the MSTest.Sdk project SDK.Compare with Shouldly
NNSubstituteNSubstitute is a BSD-3-Clause mocking library for .NET with a concise, readable syntax for creating substitutes, configuring returns and checking received calls.Compare with Shouldly
MMoqMoq is a popular MIT-licensed mocking library for .NET that uses lambda expressions to set up and verify mocks; stable v4.x is maintained on the v4 branch while the main branch hosts the upcoming v5.Compare with Shouldly