Running tests techniques
By systematically covering all endpoints and scenarios, you ensure that your API behaves correctly under various conditions, providing confidence in your application’s functionality. Thoroughly testing API endpoints is essential for building reliable and robust applications.
The recipe will explain to you how to run tests individually or by group and how to check the test coverage of our code.
Getting ready
To run the recipe, make sure you already have some tests in place, or you already followed all the previous recipes of the chapter. Also, make sure you have your PYTHONPATH for tests defined in your pytest.ini
. Have a look at the recipe Setting up testing environments on how to do it.
How to do it...
We will start by looking at how to run tests by default grouping (individually or by module), and then we will cover a technique for customizing test grouping based on marks.
As you already know, all unit tests can be run from the terminal...