Test for nulls and exceptional cases, but only when it makes sense

Testing nulls and exceptional cases is always important because developers often forget to handle such cases in their code. But remember that you do not want to write tests that never catch a bug. Before writing such tests, you should understand the overall picture of the software system (and its architecture). The architecture may ensure… Continue reading Test for nulls and exceptional cases, but only when it makes sense

When the number of combinations explodes, be pragmatic

If we had combined all the partitions we derived from the substringsBetween program, we would have ended up with 320 tests. This number is even larger for more complex problems. Combinatorial testing is an entire area of research in software testing; I will not dive into the techniques that have been proposed for such situations, but I… Continue reading When the number of combinations explodes, be pragmatic

Use variations of the same input to facilitate understanding

chYou can simplify your understanding of the different test cases by using the same input seed for all of them, as we noticed in an observational study with professional developers described in my paper with Treude and Zaidman (2021). For each partition, you then make small modifications to the input seed: just enough to meet… Continue reading Use variations of the same input to facilitate understanding

On and off points are enough, but feel free to add in and out points

On and off points belong to specific partitions, so they also serve as concrete test cases for the partitions. This means testing all the boundaries of your input domain is enough. Nevertheless, I often try some in and out points in my tests. They are redundant, because the on and off points exercise the same… Continue reading On and off points are enough, but feel free to add in and out points

Partition or boundary? It does not matter!

When you are exploring inputs and outputs, identifying partitions, and devising test cases, you may end up considering a boundary to be an exclusive partition and not a boundary between two partitions. It does not matter if a specific case emerges when you are identifying partitions or in the boundaries step. Each developer may interpret… Continue reading Partition or boundary? It does not matter!

The process should be iterative, not sequential

Describing iterative processes in writing is challenging. My explanation may have given you the impression that this process is fully sequential and that you move to the next step only when you have completed the previous one. However, the entire process is meant to be iterative. In practice, I go back and forth between the… Continue reading The process should be iterative, not sequential