Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.35 KB

README.md

File metadata and controls

37 lines (26 loc) · 1.35 KB

A RESTful API Test Framework Example

Code style: black

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:
    1. Print every request and response in an API output file
    2. Append common headers
    3. 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.