If you look at this #Ruby code how many tests would you write?

Before reading the next post, take a moment and try to answer this question.

I think if we look at the code and focus on line coverage, we can say that two tests might be enough.
But this also might be misleading. We can see that if we want to test the entire truth table, then we need 4 test cases:
There are various coverage criteria that we can apply and each one will result in a different number of test cases:

How do we choose between these coverage criteria?
We choose based on risk and project context.

When talking about the risk, let’s use a simple graph having a Y axis going from low risk to high risk.

When considering project context we might split the techniques in different ways
#GoodEnoughTesting means matching coverage to risk

Read the full article on the blog where I also explain what are those testing techniques and go a bit deeper into how to generate test cases with them:

https://goodenoughtesting.com/articles/how-many-tests-would-you-write

Good Enough Testing

A practical workshop that will show you a series of test design techniques, providing a systematic and repeatable approach to write test cases

PS: Two more days until the Good Enough Testing Workshop

Checkout the details at https://goodenoughtesting.com

Good Enough Testing

A practical workshop that will show you a series of test design techniques, providing a systematic and repeatable approach to write test cases

Inspired by what @thekitze implemented for the amazing Sizzy browser I implemented a page if you want to email your manager and ask them to expense this workshop

https://goodenoughtesting.com/expense

Good Enough Testing

A practical workshop that will show you a series of test design techniques, providing a systematic and repeatable approach to write test cases