Skip to content

IMAyushBatham/api-test-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Test Framework

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.

Features

  • ✅ 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

Project Structure

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

How to Run

Prerequisites

  • Go 1.16+

Steps

  1. Clone the repo

git clone https://github.com/YOUR_USERNAME/api-test-framework.git cd api-test-framework 2. Install dependencies

  1. Add your test cases to tests.yaml

  2. Run the framework

  3. Open report.html in your browser to see results

Writing Test Cases

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"

Sample Output

Terminal:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages