Running automated functional tests in a CI/CD pipeline
One of the most common tasks in a CI/CD pipeline is running automated functional tests to make sure your code does what it’s supposed to do. For example, you might want to use the pytest
framework to run a collection of unit tests written in Python to test your Python-based Hats for Cats app. Let’s see how to do that with GitLab.
Note
If you’re not familiar with pytest
, don’t worry. The syntax for pytest
unit tests is extremely simple and can be understood by anyone with even a little experience of writing automated tests in any language.
Enabling automated functional tests
Imagine that you’ve written three pytest
-based unit tests to make sure the Hats for Cats app’s login feature works as expected. You might have a file called test/test_login.py
with these contents:
def test_login(): # add code that tries to log in with good credentials ...