REST_API_Test_Framework_Python
REST_API_Test_Framework_Python copied to clipboard
REST API Test Framework example using Python requests and flask for both functional and performance tests.
A RESTful API Test Framework Example
Features:
- Support both functional and performance tests
- Test by parametrized input / output text files
- Use flask to mock API services dynamically with magic
- HTML report
- Common get/post/request functions to:
- Print every request and response in an API output file
- Append common headers
- Handle request exceptions and non-20X response codes, so you only need to focus on normal json response.
Install:
pip install -r Scripts/requirements.txt
Run:
cd Scripts
Start API mock services:
python flask_mock_service.py
Run Functional tests:
pytest
Run Performance tests:
python perf_test_rest_api.py
Medium Post
Check out the medium post for more details.
HTML Report
For HTML report generation, we are using pytest-html which is simple and effective.
Other alternatives to generate fancier HTML reports are Allure and reportportal. Note these report frameworks are heavy, especially reportportal.