Book Image

Testing with JUnit

By : Leonard Przybylski, Frank Appel
Book Image

Testing with JUnit

By: Leonard Przybylski, Frank Appel

Overview of this book

Table of Contents (16 chapters)
Testing with JUnit
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Choosing the next functionality to test


Now that you know how to structure a test properly, you still might feel a bit insecure about what to test, where to start, how to continue, and how to know when you are done. What follows will be a few heuristics to help you in mastering these hurdles.

Start with the happy path

Meszaros defines the happy path as the normal path of execution through a use case or the software that implements it; also known as the sunny day scenario. Nothing goes wrong, nothing out of the ordinary happens, and we swiftly and directly achieve the user's or caller's goal, [MESZ07]. Regarding the addition of an item to our timeline functionality, the happy path is made up of an item that gets sorted into a list of existing items, and hence, gets depicted at the correct chronological position.

But what makes it so important to start with it? Because it delivers the highest business value, and gets us closer to the component's expected capabilities. Once we are done with the...