0PricingLogin
Scala for Backend Engineering & Functional Programming · Lesson

Property-Based Testing

ScalaCheck.

What is Property-Based Testing?

In property-based testing you state a general property that should hold for all inputs, and the framework generates many random inputs to try to falsify it. This finds edge cases hand-written examples miss.

Example vs Property

An example test checks one case: reverse(List(1,2,3)) == List(3,2,1). A property states a rule: reversing twice yields the original list, for any list. The framework checks that rule on hundreds of generated lists.

All lessons in this course

  1. ScalaTest Styles
  2. Matchers
  3. Property-Based Testing
  4. Mocking and Fixtures
← Back to Scala for Backend Engineering & Functional Programming