How salimsuprayogi/rest_api_testing_in_python works
Project type and purpose
• This is an open-source REST API testing utility written in Python.
• Its sole purpose is to execute HTTP requests (GET, POST, DELETE), read input JSON, parse responses, validate them, and print results.
File structure
• Top-level files:
– LICENSE, README.md – documentation and licensing.
– venv/ – isolated Python environment with dependencies (requests, json, jsonpath).
– get_request/ – contains all test scripts and test data.
• Inside get_request/:
– 1_get_request.py, 2_get_fetch_value.py, 3_delete_user.py, 4_post_create_user.py – each script exercises one API scenario.
– data_create_user.json – payload used by the POST script.
README for additional insights
• Dependencies: Python 3.8.5, requests, json, jsonpath.
• Described capabilities: get, delete, post, response parsing, validation.
• External test target: likely https://reqres.in/ or any REST endpoint.
a. Main components
1. Virtual Environment (venv)
2. Test Runner Scripts (get_request/*.py)
3. Input Data Store (data_create_user.json)
4. HTTP Client Library (requests module)
5. JSON Processing (built-in json + jsonpath)
6. External REST API Service (e.g. reqres.in)
7. Console/Logger (for output & validation results)
b. Relationships and data flow
– The “Test Runner Scripts” component reads “Input Data Store” when sending POST.
– Scripts invoke “HTTP Client Library” to send requests to “External REST API.”
– Responses flow back into “JSON Processing” for parsing/validation.
– Parsed results and validation outcomes are sent to “Console/Logger.”
c. Architectural patterns / principles
– Single-process, procedural test harness rather than multi-layer web app.
– Separation of concerns: each script handles one HTTP method; JSON input is decoupled.
– Reuse of standard libraries (requests, jsonpath) rather than custom networking or parsing code.
d. Key technologies / libraries
– Python 3.8.5
– requests (HTTP client)
– built-in json module
– jsonpath (for extracting values)
– Virtual environment for dependency isolation