Common Themes in Testing

Learn about some common themes in testing, particularly testing for boundary values, equivalence classes, and edge cases.

Let's briefly touch on some topics that are usually good to keep in mind when thinking of ways of how to test our code because they're recurrent and helpful.

These are points we'll usually want to think about when trying to come up with tests for the code because they lead to ruthless testing. When we're writing unit tests, our mindset has to be all about breaking the code: we want to make sure we find errors so that we can fix them, and that they don't slip into production (which will be much worse).

Boundaries or limit values

Boundary values are usually a great source of trouble in the code, so that's probably a good starting place. Take a look at the code and inspect for conditions set around some values. Then, add tests to make sure we include these values.

For example, look at a line of code such as this:

Get hands-on with 1400+ tech skills courses.