Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

hmcts/hmi-api-gateway-fh

Repository files navigation

HMI API Gateway

Build Status

Purpose

The purpose of this README is to speed up the creation,usage and management of tests for the Functional, Acceptance, Integration, Contract and Smoke Tests.

What's inside

The template is a working application with a minimal setup. It contains:

  • application set up code
  • Developer Tests
  • QA Tests (Smoke, Acceptance, Contract, Functional and Security)
  • docker setup
  • swagger configuration for api documentation (see how to publish your api documentation to shared repository)
  • code quality tools already set up
  • integration with Azure Dev Ops
  • Helm chart using chart-java.

Plugins

The template contains the following plugins:

Setup

Located in ./bin/init.sh. Simply run and follow the explanation how to execute it.

Notes

Since Spring Boot 2.1 bean overriding is disabled. If you want to enable it you will need to set spring.main.allow-bean-definition-overriding to true.

JUnit 5 is now enabled by default in the project. Please refrain from using JUnit4 (except for libraries not able to support Junit5 like Serenity) and use the next generation

Building and deploying the application

Building the application (for purpose of running the test)

The project uses Gradle as a build tool. It already contains ./gradlew wrapper script, so there's no need to install gradle.

To build the project execute the following command:

###Copy Paste the link in browser for detailed steps to run following tests in local-https://tools.hmcts.net/confluence/display/HMI/HMI+QA+Functional+Testing

  ./gradlew build

Running the Unit Tests

Add application-test.docx file under Test Resources for Unit Testing in local.

Change Directory to the root folder of the Project:

Run the following command

  gradle clean Unit -DENDPOINT_URL='{url}' -DENDPOINT_HOST='{hostname}' -DENDPOINT_SUBSCRIPTION_KEY={subscriptonKey} -DAPI_LOG_LEVEL=OFF

### Running the Functional Tests
### Add application-functional.docx file under functional Resources for Unit Testing in local.


Change Directory to the root folder of the Project:

Run the following command

```bash
  gradle clean functional -DENDPOINT_URL='{url}' -DENDPOINT_HOST='{hostname}' -DENDPOINT_SUBSCRIPTION_KEY={subscriptonKey} -DAPI_LOG_LEVEL=OFF

Running the Smoke Tests

Add application-smoke.docx file under smoke Resources for Unit Testing in local.

Change Directory to the root folder of the Project:

Run the following command

  gradle clean smoke -DENDPOINT_URL='{url}' -DENDPOINT_SUBSCRIPTION_KEY={subscriptonKey} -DAPI_LOG_LEVEL=DEBUG

Running the Integration Tests

Change Directory to the root folder of the Project:

Run the following command

  gradle clean integration -DENDPOINT_URL='{url}' -DENDPOINT_SUBSCRIPTION_KEY={subscriptonKey}

Running the Acceptance Tests

Add application-acceptance.docx file under acceptance Resources for Unit Testing in local.

Change Directory to the root folder of the Project:

Run the following command

  gradle clean acceptance -DENDPOINT_URL='{url}' -DENDPOINT_SUBSCRIPTION_KEY={subscriptonKey} -DAPI_LOG_LEVEL=DEBUG

Running the Contract Tests

Change Directory to the root folder of the Project:

Start the broker first running the pact docker-compose:

STARTING THE BROKER

docker-compose -f docker-pactbroker-compose.yml up

You can run contract or pact tests as follows: Run the following command

  gradle clean contract -DENDPOINT_HOST='{hostname}' -DENDPOINT_SUBSCRIPTION_KEY={subscriptonKey} -DAPI_LOG_LEVEL=OFF

PUBLISHING YOUR PACT
You can publish your pact tests locally by using it to publish your tests:

./gradlew pactPublish

VERIFY YOUR PACT

Make sure that your end point is up and running...

The following command should perform all the verifications tests

./gradlew clean pactVerify -Ppact.verifier.publishResults=true

This project is licensed under the MIT License - see the LICENSE file for details