A lightweight REST API testing framework built in Go from scratch. Reads test cases from a YAML file, executes them, and generates a clean HTML report.
- ✅ Supports GET and POST requests
- ✅ Validates HTTP status codes
- ✅ Validates response body content
- ✅ Measures response time for each API
- ✅ Generates a clean HTML test report
api-test-framework/ ├── main.go # Entry point, runs all tests ├── testcase.go # TestCase struct definition ├── result.go # TestResult struct definition ├── reporter.go # HTML report generator ├── tests.yaml # Test case definitions └── report.html # Generated after running
- Go 1.16+
- Clone the repo
git clone https://github.com/YOUR_USERNAME/api-test-framework.git cd api-test-framework 2. Install dependencies
-
Add your test cases to
tests.yaml -
Run the framework
-
Open
report.htmlin your browser to see results
Edit tests.yaml to add your own tests:
- name: "My API test"
url: "https://api.example.com/endpoint"
method: GET
expected_status: 200
expect_contains: "success"
- name: "Create a resource"
url: "https://api.example.com/resource"
method: POST
body: '{"key": "value"}'
expected_status: 201
expect_contains: "id"Terminal: