Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Software Testing with JUnit 5

You're reading from   Mastering Software Testing with JUnit 5 Comprehensive guide to develop high quality Java applications

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787285736
Length 350 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Boni Garcia Boni Garcia
Author Profile Icon Boni Garcia
Boni Garcia
Arrow right icon
View More author details
Toc

Assertions

As we know, the general structure of a test case is composed of four stages: setup, exercise, verify, and tear down. The actual test happens during the second and third stage, when the test logic interacts with the system under test, getting some kind of outcome from it. This outcome is compared with the expected result in the verify stage. In this stage, we find what we call assertions. In this section, we take a closer look at them.

An assertion (also known as a predicate) is a boolean statement typically used to reason about software correctness. From a technical point of view, an assertion is composed of three parts (see the image after the list):

  1. First, we find the expected value, which comes from what we call test oracles. A test oracle is a reliable source of expected outputs, for example, the system specification.
  2. Second, we find the real outcome, which comes...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime