A REST API automation framework built with JavaScript and Node.js for testing RESTful APIs using modern automation practices.
It demonstrates API functional testing, schema validation, data-driven testing, mock testing, basic performance testing, Docker, Docker Compose, and GitHub Actions.
This project tests the public JSONPlaceholder REST API and demonstrates how an API automation framework can be organized with a clean structure, reusable components, and easy maintenance.
The framework includes reusable utilities, separated test data, schema validation, mocked responses, Docker support, and automated test execution through GitHub Actions.
- JavaScript
- Node.js
- Supertest
- Mocha
- Chai
- AJV
- Nock
- Docker
- Docker Compose
- GitHub Actions
- Grafana k6
real-api-automation-project
│
├── .github/
│ └── workflows/
│ └── ci.yml
│
├── config/
│ └── config.js
│
├── data/
│ └── users.data.json
│
├── mocks/
│ └── users.mock.test.js
│
├── performance/
│ └── load-test.js
│
├── schemas/
│ └── user.schema.json
│
├── tests/
│ ├── data-driven/
│ ├── negative/
│ ├── posts/
│ └── users/
│
├── utils/
│ ├── helpers.js
│ ├── logger.js
│ ├── request.js
│ ├── retry.js
│ └── validator.js
│
├── Dockerfile
├── docker-compose.yml
├── package.json
└── README.md
- Get all users
- Get user by ID
- Create a new user
- Update a user
- Delete a user
- Get all posts
- Get post by ID
- Create a new post
- Update a post
- Partially update a post
- Delete a post
- Invalid endpoint
- Resource not found
- Mocked server error using Nock
API responses are validated against JSON Schemas using AJV to ensure response consistency.
Test data is separated from the test logic using external JSON files, making test cases easier to maintain and extend.
API responses are mocked using Nock to simulate different server behaviors without calling the real API.
Basic API load testing is implemented using Grafana k6.
Current configuration:
- 5 Virtual Users (VUs)
- 10 seconds duration
- HTTP status validation
Run the performance test:
k6 run performance/load-test.jsCurrent automated test suite:
15 Functional Tests Passing
3 Mock Tests Passing
The project has been successfully tested:
- Locally
- Inside Docker
- Using Docker Compose
- Through GitHub Actions CI
Clone the repository
git clone https://github.com/coderaliennadafy/Real-API-Automation-Project.gitMove into the project directory
cd Real-API-Automation-ProjectInstall dependencies
npm installRun all functional tests
npm testRun mock tests
npm run test:mocksBuild the Docker image
docker build -t api-automation .Run the test suite inside a container
docker run --rm api-automationRun using Docker Compose
docker compose upGitHub Actions automatically runs the test suite on every push to the master branch.
The workflow performs the following steps:
- Checkout repository
- Setup Node.js
- Install project dependencies
- Run the complete test suite
- REST API Functional Testing
- CRUD Operations
- Positive & Negative Testing
- Data-Driven Testing
- JSON Schema Validation (AJV)
- Mock API Testing (Nock)
- Basic Performance Testing (Grafana k6)
- Docker Support
- Docker Compose
- GitHub Actions CI
- Playwright API Testing
- HTML Test Reports
- Allure Reporting
- Advanced Performance Testing
- API Authentication Testing
Ali Ennadafy
Software QA Tester focused on API testing, automation, and software quality.