Sign inSign up

rvancea/qa-practice-api

By rvancea

Updated over 3 years ago

CRUD REST API application that includes OpenAPI (Swagger)

Image
0

1.6K

rvancea/qa-practice-api repository overview

This application has been designed to be used by the QA Engineers to practice and improve their API manual and automation testing skills. It includes CRUD REST API Endpoints and OpenAPI Documentation (Swagger).

  • GET /api/v1/employees - returns list of all employees
  • POST /api/v1/employees - creates a new employee
  • GET /api/v1/employees/{ID} - returns specific employee by ID
  • PUT /api/v1/employees/{ID} - updates specific employee by ID
  • DELETE /api/v1/employees/{ID} - deletes specific employee by ID
  • GET /api/v1/simulate/server/error - simulates internal server error, status code 500

JWT Authorization

  • POST /api/v1/simulate/token - simulates an endpoint that returns JWT value (the request body should include an object with 'username' and 'password' properties, both having 'admin' as value)
  • GET /api/v1/simulate/get/employees - requires the above JWT value (returned by POST /api/v1/simulate/token) as Authorization header (Bearer value) to return status code 200 with a list of all employees, otherwise it will return status code 401

Prerequisites

Make sure that you have Docker installed on your machine (PC/Laptop).

How to run the app

docker run -d --rm --name qa-practice-api -p8887:8081 rvancea/qa-practice-api:latest

Congrats! Now you can open the app via browser

http://localhost:8887/swagger-ui.html
App debugging & logs
docker logs qa-practice-api
Notes regarding the running command
  • replace 8887 with any other desired port that will be used by the app
  • remove '--rm' from the command if you want to persist the container for further use; otherwise, when you stop the app, the container will be removed as well
  • -d makes the app to run in the background of your terminal. It does not receive input or display output. If you want the logs to be instantly shown in the terminal, remove this flag.
Tech stack of the app

Java with Maven, Springboot, and H2 in-memory database

Note: when restarting the app, the database will be reset to initial default records. It means that if you added/updated employees, they will no longer be available.
Contact me for improvements/ideas

https://razvanvancea.ro/#contact

Tag summary

Content type

Image

Digest

sha256:f5e40821f

Size

111.2 MB

Last updated

over 3 years ago

docker pull rvancea/qa-practice-api