This tutorial is based on a simple but realistic system under test, aiming to show some ways you can test and find bugs in such logic using property-based testing It covers refactoring, dealing with non-determinism, testing generators themselves, number of examples to run, and coupling between tests and implementation.
Have some Hedgehog tests to write? Here’s five useful features you may not know about!
It can be hard to see how property-based testing applies to your day-to-day work. How do you go beyond testing small pure functions?
This talk Oskar describes techniques that you can use to test the “ugly” parts of your system, and dig deeper into a few case studies from Komposition, a screencast video editor written in Haskell.
Andrew takes you on a guided tour of Hedgehog's state machine testing facilities and then presents a series of examples to show off what you can do. This will show you how to start applying this tool to your own projects.
The application being tested will be a servant web application, and examples include testing fundamentals such as content creation and deletion, uniqueness constraints, and authentication.
Andrew gives an introduction to state machine testing with Hedgehog and shows why it's a great solution to testing code that deals with mutable state.
This series supplements the fast paced talk above with a slower-paced introduction over a series of blog posts.
Jacob highlights the technical and social problems that he and his coworkers experienced with the type-directed shrinking approach which QuickCheck takes. He explores the alternative, integrated shrinking, and shows that even in a statically typed language, integrated shrinking provides enormous benefits for developer productivity.
You will learn about the difference between type-directed and integrated shrinking, and how integrated shrinking can provide superior counterexamples, while placing a smaller burden on developers writing tests.
In Haskell, QuickCheck has been the library of choice for property-based testing, but Hedgehog has been gaining popularity. One of the key differences between these two is that in QuickCheck one writes explicit generation and shrinking functions, whereas in Hedgehog shrinking is integrated in generation.
In this blog post Edsko explains what that means by developing a mini-QuickCheck and mini-Hedgehog and comparing the two.
State Machine Testing is an extremely powerful technique, and builds upon property based testing and even temporal logic. It can go beyond standard property based testing, in that we can easily test highly stateful external systems, such as distributed systems, C libraries, and databases – even finding race conditions and concurrency issues. In this talk, Huw looks at what state machine testing is, and how it works in Hedgehog by reimplementing a simple QuickCheck clone, and writing a State Machine Testing library on top of it.