Skip to content

rabestro/pig-latin-rest

Repository files navigation

Quality Gate Status API docs Deployed on Azure

Pig Latin Translator

This is a REST application that translates English sentences into Pig Latin. The rules and instructions for the Pig Latin translation were obtained from the Pig Latin exercise on the Exercism Java Track.

The application was created to experiment with the API-first approach: the OpenAPI specification was created first, then the code was generated for Spring, and finally, custom code was added that depends on the generated code.

Getting Started

Before opening the code for editing, run the following command to generate the necessary code:

mvn clean compile

This command cleans the project, compiles the source code, and generates the code that the custom code depends on. After running this command, you should be able to open the code without getting any error messages.

Running the Application Locally

To run the application locally, use the following command:

mvn clean compile spring-boot:run

This will start the application on localhost:8080. You can access the Swagger UI at http://localhost:8080/swagger-ui/ and the application endpoint at http://localhost:8080/pig-latin.

Deployed Application

The application is deployed on Azure at https://piglatin.azurewebsites.net.

You can use the simple web interface and the Swagger UI.

Please note that the application is deployed on the free-tier F1 plan. This means that if the application is in sleep mode, it may take about a minute for the first API call to wake it up. Subsequent API calls should be faster.

API Testing

The application includes API tests written with frameworks:

Bruno

To run the Bruno API tests, use the following commands:

cd bruno-test
npm run test

Successful test report: https://github.com/rabestro/pig-latin-rest/runs/20357669812

Failed test report: https://github.com/rabestro/pig-latin-rest/runs/20706167144#r0s1

Note

Note - Bruno's script support might also be used for light test automation based on project specifics.

JetBrains HTTP Client

HTTP Client - Secret Weapon for Web Service Testing

HTTP Client CLI

Successful test report: https://github.com/rabestro/pig-latin-rest/runs/20240718373

Failed test report: https://github.com/rabestro/pig-latin-rest/runs/20241724987

httpYac - the Free alternative of JetBrains HTTP Client

https://httpyac.github.io/

Karate

To run the Karate API tests, use the following command:

mvn clean test -Dtest=TestRunner

Performance Testing by Apache jMeter

Load Test Descriptive Summary/Conclusions and Full Report