SlideShare a Scribd company logo
Gorilla Logic Proprietary and Confidential
Improving Automated Tests with Fluent
Assertions Jorge Vega Citalan
jorge.vega.citalan@gmail.com
Gorilla Logic Proprietary and Confidential
Agenda
Introduction
Supported Frameworks and Platforms
Common Asserts
Assertions Scope
Asserts with JSON
Java, Python & JavaScript?
2
1
3
4
5
6
2
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Introduction
Gorilla Logic Proprietary and Confidential
Introduction
❏ Improve readability of test source code.
4
Gorilla Logic Proprietary and Confidential
Introduction
❏ Clearer explanations about why a test
failed.
5
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Supported Frameworks and Platforms
Gorilla Logic Proprietary and Confidential
Supported Frameworks
❏ Fluent Assertions supports the following unit
test frameworks:
■ MSTest (Visual Studio 2010, 2012 Update 2, 2013
and 2015)
■ MSTest2 (Visual Studio 2017, Visual Studio 2019)
■ NUnit
■ XUnit
■ XUnit2
■ MBUnit
■ Gallio
■ NSpec
■ MSpec
7
Gorilla Logic Proprietary and Confidential
Supported Platforms
❏ Fluent Assertions supports the following
minimum platforms:
■ .NET Core 1.0 and 2.0
■ .NET Framework 4.5
■ Mono, Xamarin.iOS 10.0, Xamarin.Mac 3.0 and
Xamarin.Android 7.0
■ Universal Windows Platform
8
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Common Asserts
Gorilla Logic Proprietary and Confidential
Strings
❏ Null, empty or contains whitespace only.
10
Gorilla Logic Proprietary and Confidential
Strings
❏ Common assertions.
11
Gorilla Logic Proprietary and Confidential
Strings
❏ Contain certain values.
12
Gorilla Logic Proprietary and Confidential
Strings
❏ Wildcards and Regular Expressions.
13
Gorilla Logic Proprietary and Confidential
Numerical and IComparable<T>
❏ Common assertions.
14
Gorilla Logic Proprietary and Confidential
Numerical
❏ Doubles and Floats.
15
Gorilla Logic Proprietary and Confidential
Numerical
❏ Assertions against a list of values.
16
Gorilla Logic Proprietary and Confidential
Dates
❏ Common assertions.
17
Gorilla Logic Proprietary and Confidential
Dates
❏ Date details.
18
Gorilla Logic Proprietary and Confidential
Dates
❏ Ranges.
19
Gorilla Logic Proprietary and Confidential
Nullable
❏ Common assertions.
20
Gorilla Logic Proprietary and Confidential
Collections
❏ Common asserts.
21
Gorilla Logic Proprietary and Confidential
Collections
❏ Individual assertions on all elements of a
collection.
22
Gorilla Logic Proprietary and Confidential
Dictionaries
❏ Common asserts.
23
Gorilla Logic Proprietary and Confidential
Dictionaries
❏ Common asserts.
24
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Assertions Scope
Gorilla Logic Proprietary and Confidential
Assertions Scope
❏ Batch multiple assertions into an AssertionScope
so that FluentAssertions throws one exception
at the end of the scope with all failures.
26
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Asserts with JSON
Gorilla Logic Proprietary and Confidential
JSON
❏ Assertions allowed:
■ BeEquivalentTo()
■ ContainSingleElement()
■ ContainSubtree()
■ HaveCount()
■ HaveElement()
■ HaveValue()
■ MatchRegex()
■ NotBeEquivalentTo()
■ NotHaveElement()
■ NotHaveValue()
■ NotMatchRegex()
28
Gorilla Logic Proprietary and Confidential
JSON
❏ Be sure to include using FluentAssertions.Json;
otherwise false positives may occur.
29
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Java, Python & JavaScript?
Gorilla Logic Proprietary and Confidential
Java
❏ AssertJ (https://joel-costigliola.github.io/assertj/)
31
Gorilla Logic Proprietary and Confidential
Python
❏ Fluentcheck (https://github.com/csparpa/fluentcheck)
32
Gorilla Logic Proprietary and Confidential
Python
❏ Assertpj (https://pypi.org/project/assertpy/)
33
Gorilla Logic Proprietary and Confidential
JavaScript
❏ Chai (https://www.chaijs.com/guide/styles/#should)
34
Gorilla Logic Proprietary and ConfidentialGorilla Logic Proprietary and Confidential
Demo
Gorilla Logic Proprietary and Confidential
Q&A
"With Fluent Assertions, the assertions look
beautiful, natural and most importantly, extremely
readable" Garish

More Related Content

PPTX
Introduction to nsubstitute
PPTX
Generic Test Automation Architecture
PDF
Hardening
PDF
Judge: Identifying, Understanding, and Evaluating Sources of Unsoundness in C...
PDF
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
PDF
Embracing Disruption: Adding a Bit of Chaos to Help You Grow
PDF
16 things a developer should know about testing
PDF
[FullStack NYC 2019] Effective Unit Tests for JavaScript
Introduction to nsubstitute
Generic Test Automation Architecture
Hardening
Judge: Identifying, Understanding, and Evaluating Sources of Unsoundness in C...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Embracing Disruption: Adding a Bit of Chaos to Help You Grow
16 things a developer should know about testing
[FullStack NYC 2019] Effective Unit Tests for JavaScript

Similar to Improving Automated Tests with Fluent Assertions (17)

PDF
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
PDF
effective java
PDF
Scraping metrics for fun and profit
PDF
Make it test-driven with CDI!
PDF
the grinder testing certification
PDF
Pair Development from the Trenches
PDF
Evolving The Java Language
PDF
Production-ready GraphQL with Caliban
PDF
What Code Is Deliberately Excluded from Test Coverage and Why? (MSR 2021)
PDF
Compliance Superpowers - Ben Blair, Chicago
KEY
Cascalog at Strange Loop
PPTX
Introduction to GraphQL
PDF
Entregando Bons Resultados com BDD
PPTX
Session 18 - Review Session and Attending Java Interviews
PDF
A Java Developers first Clojure project
PDF
Zero con2019
PDF
GraphQL Server - Single point of opportunities
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
effective java
Scraping metrics for fun and profit
Make it test-driven with CDI!
the grinder testing certification
Pair Development from the Trenches
Evolving The Java Language
Production-ready GraphQL with Caliban
What Code Is Deliberately Excluded from Test Coverage and Why? (MSR 2021)
Compliance Superpowers - Ben Blair, Chicago
Cascalog at Strange Loop
Introduction to GraphQL
Entregando Bons Resultados com BDD
Session 18 - Review Session and Attending Java Interviews
A Java Developers first Clojure project
Zero con2019
GraphQL Server - Single point of opportunities
Ad

More from TestingCR (14)

PDF
Webinar - Scrum for Beginners! impartida por Melissa Leyva
PDF
WEBINAR: Mejora Continua en equipos de Testing por Nadia Cavalleri
PDF
Patrones de diseño en la automatización, PageObject o ScreenPlay
PDF
How can we start in the QA World?
PPTX
Mobile Automation Basic Concepts / Demo
PDF
UX/UI: QA Approved
PPTX
El papel del liderazgo femenino en el campo tecnológico y su balance con la v...
PPTX
Pruebas De Seguridad Aplicadas a QA
PDF
Choosing the correct test case manager
PPTX
Puro Jmeter, Pura Vida! - Base de Datos y Webservices desde Jmeter
PDF
Webinar: Los mil millones de usuarios que debes considerar en tus pruebas
PDF
WEBINAR: Testing Exploratorio y Mind Maps por Claudia Badell
PDF
Estado del testing 2019
PPTX
Automation Image Comparison Testing
Webinar - Scrum for Beginners! impartida por Melissa Leyva
WEBINAR: Mejora Continua en equipos de Testing por Nadia Cavalleri
Patrones de diseño en la automatización, PageObject o ScreenPlay
How can we start in the QA World?
Mobile Automation Basic Concepts / Demo
UX/UI: QA Approved
El papel del liderazgo femenino en el campo tecnológico y su balance con la v...
Pruebas De Seguridad Aplicadas a QA
Choosing the correct test case manager
Puro Jmeter, Pura Vida! - Base de Datos y Webservices desde Jmeter
Webinar: Los mil millones de usuarios que debes considerar en tus pruebas
WEBINAR: Testing Exploratorio y Mind Maps por Claudia Badell
Estado del testing 2019
Automation Image Comparison Testing
Ad

Recently uploaded (20)

PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Digital Logic Computer Design lecture notes
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Geodesy 1.pptx...............................................
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
introduction to datamining and warehousing
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Current and future trends in Computer Vision.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT
Project quality management in manufacturing
PPTX
Construction Project Organization Group 2.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Foundation to blockchain - A guide to Blockchain Tech
Model Code of Practice - Construction Work - 21102022 .pdf
Digital Logic Computer Design lecture notes
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Geodesy 1.pptx...............................................
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
introduction to datamining and warehousing
Embodied AI: Ushering in the Next Era of Intelligent Systems
Current and future trends in Computer Vision.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
bas. eng. economics group 4 presentation 1.pptx
OOP with Java - Java Introduction (Basics)
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Project quality management in manufacturing
Construction Project Organization Group 2.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Lecture Notes Electrical Wiring System Components
Foundation to blockchain - A guide to Blockchain Tech

Improving Automated Tests with Fluent Assertions