DEV Community

Fleek It Solutions
Fleek It Solutions

Posted on

API automation using Python and open-source framework


Writing test case
As now you already have setup your python project with Pycharm, let’s create a new python file where we will add our test cases.

Please create a new python file in your project. Let’s name it “”. Notice the “test_” in your file name. This is as per the rules for PyTest. We will be running our tests using Python’s inbuilt testing framework called PyTest. PyTest picks all those python files in your project which start with “test_” for test execution.

In “” file, our first statement would be :

import requests
“requests” is python’s inbuilt module which is used to send http requests to a server. We will be using this module to send requests to our API and record the response.

Now, for this tutorial we will be using a sample test API available online :
We will be sending requests to the endpoints defined in this API.


Discussion (0)