API Testing Suite using Docker

Introduction

This Docker Assignment focuses on building a containerized API testing environment using Docker and Newman (Postman’s CLI). The project is divided into three parts each progressively adds new functionality such as orchestration, persistence, and documentation. The final setup automates API testing, generates reports, and provides a clear technical record of the entire process.


Objectives of Part 1

  • Build a minimal Newman container using node:18-alpine.

  • Run a Postman collection inside the container.

  • Generate an HTML test report.

  • Verify containerized API testing and establish a reusable base image.


Objectives of Part 2

  • Implement Docker Compose for orchestration.

  • Add volume mapping (./reports:/etc/newman/reports) to persist reports.

  • Enable generation of both HTML and JSON reports.

  • Run and manage tests with a single docker compose up command.


Objectives of Part 3

  • Prepare documentation for Parts 1 and 2, detailing the complete process.

  • Explain the architecture, container setup, and workflow.

  • Compile procedures, results, and outcomes for submission.

  • Provide a final report summarizing the learning and technical insights.


Containers Involved and Download Links

  1. node:18-alpine — Base image providing lightweight Node.js runtime.
    Docker Hub: docker pull node:18-alpine

  2. newman-tests (Custom) — Custom image with Newman and HTML reporter installed.
    GitHub: https://github.com/WebDevHarsha/api_test_suite


Other Software and Purpose

  • Docker Engine / Desktop — To build and run containers.

  • Docker Compose — Orchestration and volume management.

  • Newman — CLI runner for Postman collections.

  • newman-reporter-html — Generates HTML reports.

  • Postman — Used to create and export collections.

  • Git / GitHub — Version control and repository hosting.


Overall Architecture

The system workflow:

  1. Input: collection.json, Dockerfile, and optional docker-compose.yml.

  2. Process: Docker builds a Newman image → runs tests → generates reports.

  3. Output: HTML and JSON reports in ./reports.




Two-Page Description (Summary)

The architecture is designed in layers:

  • Container Layer: Uses Node.js with Newman for running tests.

  • Orchestration Layer: Docker Compose manages builds, volumes, and environment consistency.

  • Persistence Layer: Mounted host volumes store reports outside containers.
    Each part enhances functionality — Part 1 creates the base image, Part 2 adds orchestration and report persistence, and Part 3 documents the entire implementation and results. Together, they form a well-documented, reproducible testing framework.


Procedure (Part 1)

  1. Create project directories and Postman collection.

  2. Write Dockerfile with Node base and Newman install.

  3. Build image: docker build -t newman-tests ./newman.

  4. Run container and verify generated report.html.


Procedure (Part 2)

  1. Write docker-compose.yml with volume mapping.

  2. Update Dockerfile to output reports to /etc/newman/reports.

  3. Run: docker compose up --build.

  4. Confirm report.html and report.json in ./reports.


Procedure (Part 3)

  1. Document the steps and results of Part 1 and Part 2.

  2. Summarize the objectives, tools, and outcomes.

  3. Prepare architectural diagrams and explanations.

  4. Compile the final report for submission.


Container Modifications

  1. Installed newman and newman-reporter-html globally.

  2. Added working directory /etc/newman.

  3. Copied collection.json.

  4. Configured ENTRYPOINT and CMD.

  5. Mounted volume for persistent reports.


 Links


Outcomes

  • Fully automated API testing pipeline using Docker and Newman.

  • Persistent, multi-format reporting (CLI, HTML, JSON).

  • Seamless orchestration via Docker Compose.

  • Well-documented architecture and workflow explanation.

  • Portable, reproducible test environment for developers.


Conclusion

This Docker assignment demonstrates how containerization simplifies API testing through consistent, reproducible environments. Parts 1 and 2 established the technical foundation, while Part 3 focused on documenting the architecture, procedures, and insights gained. The result is a clear, well-structured system that highlights the efficiency and scalability of Docker in modern DevOps workflows.


- Sri Harsha V A

Comments