Skip to content

Commit da2ea55

Browse files
committed
docs: add decision document for migrating from Fluent Assertions to Shouldly
1 parent 01386bd commit da2ea55

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
= 26. Select Fluent Assertion Alternative Due to Licensing Issue
2+
3+
Date: 2025-09-04
4+
5+
== Problem
6+
7+
We have been using Fluent Assertions as an assertion library to enhance the readability and maintainability of our test code through fluent interfaces. However, starting from version 8, Fluent Assertions has transitioned to a paid NuGet package. Given the current pricing model, the cost outweighs the benefits it provides to our project. Consequently, we are evaluating open-source alternatives to replace Fluent Assertions.
8+
9+
=== Option 1: NFluentAssertions
10+
11+
This library is a fork of Fluent Assertions, allowing us to transition without modifying our existing assertions—only a NuGet package change is required.
12+
13+
The project is maintained by a separate group of developers, raising concerns about its long-term stability and ongoing support.
14+
15+
Repository: https://github.com/tpierrain/NFluent
16+
17+
=== Option 2: MSTest Assertions
18+
19+
These assertions are the standard Microsoft .NET testing utilities, maintained and updated with each .NET release.
20+
21+
They offer a reliable and well-supported alternative but lack the fluent syntax, resulting in assertions that are less readable and more verbose.
22+
23+
Documentation: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-mstest
24+
25+
=== Option 3: Shouldly
26+
27+
Shouldly provides a similar fluent interface to Fluent Assertions with minor syntactic differences.
28+
29+
It is widely supported, maintained by an active community of contributors, and backed by sponsors, ensuring its long-term viability.
30+
31+
The primary downside is the need to refactor existing assertions to align with Shouldly’s syntax.
32+
33+
Repository: https://github.com/shouldly/shouldly
34+
35+
== Decision
36+
37+
After a thorough analysis of available options, we have decided to migrate from Fluent Assertions to Shouldly.
38+
39+
== Consequences
40+
- Improved Long-Term Stability: Shouldly is actively maintained and supported by the open-source community, reducing the risk of unexpected licensing changes.
41+
- Maintainability & Readability: Shouldly retains a fluent syntax, ensuring our tests remain easy to read and maintain.
42+
- Refactoring Effort: Transitioning to Shouldly requires refactoring existing assertions, introducing short-term overhead but ensuring long-term sustainability.
43+
- Cost Reduction: Moving away from a paid assertion library eliminates unnecessary expenditure while maintaining similar functionality.
44+
- Ecosystem Alignment: Shouldly is widely adopted in the .NET ecosystem, ensuring compatibility and integration with modern development workflows.

0 commit comments

Comments
 (0)