Verifying your code
Let’s configure your pipeline so that it can verify your code by running functional tests, Code Quality scanning, and fuzz tests.
Adding functional tests to the pipeline
Many teams start populating their pipelines by adding tasks to run automated functional tests to make sure their code is behaving the way it was designed to. You learned in previous chapters that there are many different sorts of functional tests. In this example, we’ll add some basic automated unit tests written with the pytest
framework. Our project’s code is not yet complicated enough to require real unit tests, but for the sake of this example, we can add dummy tests so that GitLab can run them and display their results.
Before adding any tests, let’s make our login code slightly more complicated by adding a function that our tests can exercise, and a “to-do” comment that not only reminds us to flesh out this placeholder function later but also...