This repository contains example scripts for API test automation using:
- Robot Framework
- Requests Library for API interaction
- Examples of GET, POST, and Protected API requests.
- Clear demonstration of test automation practices with assertions and chaining requests.
- Fully automated CI pipeline using GitHub Actions.
All examples in this repository are designed to work with the Practice Software Testing API, a publicly available API for learning and practicing software testing. You can explore the API documentation and endpoints here:
👉 Practice Software Testing API 👈
- GET Request: Fetch a list of brands with
GET /brands
. - Login API: Authenticate using
POST /login
with an email/password payload. - Protected API Request: Authenticate, then use a token to fetch data with
GET /invoices
.
- Python 3.7+
- Robot Framework
- Robot Framework Requests Library
-
Clone this repository:
git clone https://github.com/testsmith-io/api-test-automation-robotframework.git
-
Navigate to the project directory:
cd api-test-automation-robotframework
-
Set Up a Virtual Environment (Optional, Recommended) Using a virtual environment ensures that dependencies for this project are isolated from your global Python environment.
In VS Code open the Command Palette (MacOs:
CMD
+SHIFT
+P
, Windows:CTRL
+SHIFT
+P
)- In the Command Palette, type and select/type:
Python: Select Interpreter
. - Choose the Python interpreter you want to use from the list OR create a new one.
This ensures VS Code uses the virtual environment for running and debugging.
- In the Command Palette, type and select/type:
-
Install dependencies:
pip install -r requirements.txt
-
Run the tests:
robot -d results tests/
The repository includes a GitHub Actions workflow to automatically execute the tests.