Introduction to property-based testing

The concept of unit testing should be well-known by any professional developer. A unit test usually contains a number of test cases. Each test case describes the expected behavior of a part of the program. The description is usually formulated in the form: for this unit of code in that specific state we expect given input to produce the following output. The developer then replicates such test cases with some deviations in the initial state and/or input data and expectations of the result in order to cover different code paths.

The specification of the test case is represented in the form of a test code relying on a testing framework. As at the moment of this writing, there are two popular testing frameworks for Scala projects, ScalaTest and Specs2. It is arguable that at least one of them should be familiar to any Scala developer, so we won't cover them in this book.

Instead, we'll take a look at alternative ways to formulate expectations about the behavior of the program.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.245.233