Skip to content

ssanj/intro-to-property-based-testing

Repository files navigation

Intro To Property-based Testing

An introduction to Property-Based Testing. The main goal of this presentation is to fill in the gaps that other PBT presentations do not.

It covers the following:

  1. The similarities and differences between Example-Based Testing and Property-Based Testing
  2. Introduction to Generators
  3. How to choose Properties
  4. Introduction to Shrinkers
  5. A few examples of increasing complexity with both EBT and PBT.
  6. Some guidelines on when to use EBT and PBT.

Examples

  1. Addition EBT PBT
  2. ToAsciiUpperCase EBT PBT
  3. Generators
  4. Diamond Kata EBT PBT

To continuously run any test through SBT use:

~test-only *TestName

For example:

~test-only *AdditionTest

or

~test-only *AdditionProps

To run a test with more than a hundred permutations use:

test:run -s number_of_permutations

and then choose the required test from the menu.

For example:

test:run -s 10000

Presentation

  1. See intro-to-property-based-testing.key
  2. See intro-to-property-based-testing-simple-msug.key

Links

  1. The lazy programmer's guide to writing 1000's of tests: An introduction to property based testing - Scott Wlaschin
  2. SBTB 2014 - I Dream of Gen'ning - Kelsey Gilmore-Innis
  3. Practical Property-Based Testing - Charles O'Farrell
  4. Midwest.io 2014 - Property-Based Testing for Better Code - Jessica Kerr
  5. Testing the Hard Stuff and Staying Sane - John Hughes

Releases

No releases published

Packages

No packages published

Languages