Skip to content

rybalkin-an/user-app

Repository files navigation

Spring boot app REST API testing

Prerequisites

Make sure you have the following tools installed:

Project Dependencies


Installing Keycloak with Docker and Importing Realm Configuration

Step 1: Run Keycloak with Docker

  1. Pull the latest Keycloak Docker image:
docker pull quay.io/keycloak/keycloak:latest
  1. Start the Keycloak container:
docker run -d --name keycloak \
  -e KEYCLOAK_ADMIN=admin \
  -e KEYCLOAK_ADMIN_PASSWORD=admin \
  -p 8080:8080 \
  quay.io/keycloak/keycloak:latest start-dev
  1. Access Keycloak at http://localhost:8080/ and log in using the credentials admin / admin.

Step 2: Import Realm Configuration

Manual import via Admin Console

  1. Access the Keycloak Admin Console at http://localhost:8080/.
  2. Select "Add Realm" and upload your realm-export.json file.
  3. Click "Create" to complete the import.

Running the Application

Follow these steps to run the Spring Boot application:

  1. Start Docker containers:
docker compose up
  1. Run the Spring Boot application:
gradle bootRun
  1. Access the API documentation in Swagger: http://localhost:8081/swagger-ui/index.html
  2. Access the UI: http://localhost:8081/users/manage

Running Tests

Execute the following command to run tests:

gradle clean test

About

Testing REST API Spring Boot App with Keycloak, Java 17, Gradle, Junit5, Testcontainer, RestAssured, MockMvc, Wiremock, Integration Testing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors