Improving Unit Tests with Fluent Assertions

Waste less time debugging failing tests by improving test failure messages, with the added benefit of making your test code more readable and maintainable, by using the Fluent Assertions library.
Course info
Rating
(11)
Level
Intermediate
Updated
May 6, 2019
Duration
40m
Table of contents
Description
Course info
Rating
(11)
Level
Intermediate
Updated
May 6, 2019
Duration
40m
Description

When tests fail it can be hard to understand exactly what caused the failures. If test failure messages are ambiguous or not detailed enough you sometimes have to fire up the debugger and run the test in debug mode just to find out what the failure was. In this course, Improving Unit Tests with Fluent Assertions, you will learn foundational knowledge of Fluent Assertions. First, you will discover how to improve the readability of your test code. Next, you will explore the different ways to assert on different result types such as strings, floating point numbers, collections, and exceptions. Finally, you will gain an understanding of how to improve test failure messages to reduce the need to waste time debugging through failing tests. When you are finished with this course, you will have the skills and knowledge of Fluent Assertions needed to improve readability and test failure messages for automated tests.

About the author
About the author

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

More from the author
Mocking with Moq and NUnit
Intermediate
1h 53m
Feb 22, 2019
Introduction to .NET Testing with NUnit 3
Intermediate
2h 6m
Dec 17, 2018
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
(Music) Hi everyone. My name's Jason Roberts, and welcome to my course, Improving Unit Tests with Fluent Assertions. I'm a freelance developer and author. Sometimes the assertions that come out of the box with testing frameworks don't provide adequate failure messages and can make your test code harder to understand. In this course, we're going to learn how to use the Fluent Assertions library as an add on to whatever testing framework you're currently using to super charge your automated tests. Some of the major topics that we'll cover include how to create more readable, fluent test code, how Fluent Assertions can save you time at debugging failing tests, how to work with strings, numbers, dates, and collections, and how to ensure your code throws the correct exceptions at the correct time. By the end of this course, you'll know how to use Fluent Assertions to complement or replace the built-in asserts that come with your test framework and improve test code readability and test failure messages. Before beginning the course, you should be familiar with basic C# syntax and have some knowledge of a testing framework such as NUnit, xUnit.net, or MSTest. I hope you'll join me on this journey to learn the Fluent Assertions library with the Improving Unit Tests with Fluent Assertions course, at Pluralsight.