Getting property-based testing to work after struggling for 3 years

I got excited about property-based testing after hearing John Hughes talk at Functional Conf 2016. I tried it that year with QuickCheck, but failed miserably (it almost derailed the entire project delivery). I cribbed about it in my talk at Functional Conf 2017. In 2018, Srihari's talk got me excited again. This time, I tried with Hedgehog, and got it to work!

This talk is about this journey and its learnings. We'll talk about how Hedgehog was used to test [1]:

  • A Postgres backed task/job queue
  • A small Wai/Servant based webapp

And no, we will not talk about the most common (and completely useless) example of reversing a list!

[1] Both of these are part of an open-sourced task/job queue library.


Outline/Structure of the Talk

  • Understanding property-based testing of pure code through real-world examples
  • Problems faced while testing stateful code (most commonly where state is stored in a DB)
  • Approaches used by various libraries for testing stateful code
  • Walk-through of how property tests were used to ensure correctness of a Postgres-backed job/task queue
  • Walk-through of how property tests were used to test a small DB-backed webapp

Learning Outcome

How to use property-testing effectively in typical web applications

Target Audience

Intermediate practitioners

Prerequisites for Attendees

Some basic familiarity with Haskell and/or property-testing will make the talk more relatable and understandable.

schedule Submitted 2 weeks ago

Public Feedback

comment Suggest improvements to the Speaker

  • Liked Saurabh Nanda

    Saurabh Nanda - Why is Haskell so hard to learn? (and how to deal with it)

    Saurabh Nanda
    Saurabh Nanda
    Vacation Labs
    schedule 2 weeks ago
    Sold Out!
    45 Mins

    Haskell is notoriously hard to learn. I have struggled with the learning curve. I have seen others struggle with it. And I have seen developers struggling to wield the language effectively even after months of learning.

    We'll talk about five things that give Haskell this (understandably) bad rep, and how to effectively deal with them during your learning phase.

  • Liked Anupam Jain

    Anupam Jain - Supercharged Web Application development with Purescript

    20 Mins

    Purescript is a purely functional, strongly typed language, that compiles to Javascript.

    It provides several high quality libraries for frontend development, and comes with excellent tooling and editor support that makes writing code a snap!

    In this talk I will provide a quick introduction to some basics of Purescript, demonstrate how to build a simple non-trivial web application with React bindings, and how to interface with existing some Javascript libraries (a React UI component lib).

    Bring your laptop to follow along.

  • Liked Sreenidhi Nair

    Sreenidhi Nair - Learnings from using haskell in production

    20 Mins
    Experience Report

    Over a period of 7 years, we have applied Haskell across Web apps, compilers, parsers for our customers across various industries. This is our report on how some of the unique features of Haskell have not only helped us create stable production environments but also break barriers. On the other hand, there is a high cost of on-boarding new developers and few other pain points. So, is Haskell worth the investment?