Testing your code with GTest and Pytest
Creating our code is the first part, but we cannot deliver it until we’ve made sure that everything is working properly. To guarantee this it is a very good idea to have automated, repeatable tests in place that will execute again and again to make sure that any new changes do not introduce regressions into our code.
TDD starts with the test code
When using test-driven development, we first create a test that calls our code, let’s say a function, and then we create a version of the function that simply returns false or null. With that version, we run the test and it will fail. Then we implement the minimum amount of code necessary to make the test pass. We then iterate these steps, creating multiple tests, until we have fully functional and tested code that we can rely on. With many different tests for each piece of code we can cover different error scenarios, corner cases and boundaries, drastically increasing...