Lesson 36. Property testing with QuickCheck
After reading lesson 36, you’ll be able to
- Use stack ghci to interact with a stack project
- Run tests with stack test
- Use QuickCheck for property testing
- Install packages with stack install
The preceding lesson introduced Haskell’s powerful build tool, stack. You saw how to build a project, but we cheated a bit. You copied the code you wrote when learning about modules and pasted it in. In this lesson, you’re going to rebuild your palindrome project, but this time you’ll develop it as though you were building a project from the beginning. Your focus this time will be on testing your code. So far in this book, you’ve done only manual testing of your functions. With stack, you can make automated tests from the beginning. You’ll start this lesson by learning about using GHCi with stack for manual testing of your modules. Then you’ll learn to use stack test to run simple unit tests you’ll write. Finally, you’ll learn about property testing and the amazing tool QuickCheck, which allows you to quickly generate many tests.