March 2019
Beginner to intermediate
182 pages
4h 6m
English
In this section, we will cover the following topics:
Let's look at a simple property-based test. We need to import a dependency before we define properties. We also need a dependency for the ScalaCheck library, which is a library for property-based tests.
In the previous section, every test extended FunSuite. We used functional tests, but we had to provide arguments explicitly. In this example, we're extending Properties from the ScalaCheck library and testing a StringType, as follows:
object PropertyBasedTesting extends Properties("StringType")
Our ScalaCheck will generate a random string for us. If we create a property-based test for a custom ...
Read now
Unlock full access