diff --git a/versioned_docs/version-2.0.0/quickstart/java-spring-boot-xml.md b/versioned_docs/version-2.0.0/quickstart/java-spring-boot-xml.md new file mode 100644 index 000000000..f7780cb54 --- /dev/null +++ b/versioned_docs/version-2.0.0/quickstart/java-spring-boot-xml.md @@ -0,0 +1,169 @@ +--- +id: java-spring-boot-xml +title: Sample REST API with Spring-Boot and XML +sidebar_label: XML API App +description: This CRUD Application demonstrates REST API endpoints that serve XML responses using Spring Boot. +tags: + - java + - spring-boot + - xml + - quickstart + - samples + - examples + - tutorial + - restful-api +keyword: + - XML + - Maven + - Springboot Framework + - REST API + - Java + - API Test generator + - Auto Testcase generation + - JAXB +--- + +## Introduction + +🌟 Explore creating REST APIs with XML responses using [Spring-Boot](https://github.com/spring-projects/spring-boot). Discover the ease of integrating XML serialization through JAXB. Let's dive right in! 🚀 + +## Pre-Requisite 🛠️ + +- Install [Java 17](https://www.oracle.com/java/technologies/downloads/) and set JAVA_HOME environment variable. +- Install [Maven](https://maven.apache.org/install.html) +- Install [Docker](https://docs.docker.com/engine/install/) (optional) + +## Get Started! 🎬 + +### Clone and Build the Application + +```bash +git clone https://github.com/keploy/samples-java.git +cd spring-boot-xml/naive-spring-boot +mvn clean install +``` + +### Run the Application + +Start the Spring Boot application with: + +```bash +mvn spring-boot:run +``` + +> **Note**: For Windows users, commands remain the same. + +## API Endpoints 📡 + +### Get User Data (XML) + +- **Endpoint**: `GET /api/user` + +Make a request using `curl`: + +```bash +curl -X GET -H \"Accept: application/xml\" http://localhost:8080/api/user +``` + +- **Endpoint**: `GET /api/users` + +Make a request using `curl`: + +```bash +curl -X GET http://localhost:8080/api/users -H "Accept: application/xml" +``` + +- **Endpoint**: `GET /api/people` + +Make a request using `curl`: + +```bash +curl -X GET http://localhost:8080/api/people -H "Accept: application/xml" +``` + +### Example XML Response + +```xml + + John Doe + 30 + 0101233333 + +``` + +## Integrating with Keploy 📥 + +Harness Keploy's test generation capabilities easily: + +### Install Keploy + +```bash + curl --silent -O -L https://keploy.io/install.sh && source install.sh +``` + +or + +### Install the cloud version - + +```bash + curl --silent -O -L https://keploy.io/ent/install.sh && source install.sh +``` + +### Record Test Cases + +```bash +keploy record -c "java -jar target/XML-0.0.1-SNAPSHOT.jar" +``` + +Start recording interactions by running: + +```bash +keploy record -c "java -jar target/XML-0.0.1-SNAPSHOT.jar" +``` + +Then, invoke the API using `curl` or your favorite API testing tool. + +### Run Generated Tests + +Execute recorded tests: + +```bash +keploy test -c "java -jar target/XML-0.0.1-SNAPSHOT.jar" --delay 10 +``` + +Review generated test reports in `Keploy/reports`. + +## Handling Failing Tests ⚠️ + +If you encounter failing tests due to variable or irrelevant data, like timestamps or dynamically generated fields, you can add them to the global noise configuration in your `keploy.yml`: + +**Example:** + +Screenshot 2025-03-11 at 12 07 04 AM + +```yaml +globalNoise: + global: + header.Date: [] + body: + # To ignore some values for a field, pass regex patterns to the corresponding array value + UserList: [] +``` + +After updating `keploy.yml` with the above configuration, rerun your tests, and the issue should be resolved. + +Screenshot 2025-03-11 at 12 07 19 AM + +## Dependencies 📚 + +- Spring Boot +- Spring Web +- JAXB (XML serialization) + +## Wrapping Up 🎉 + +Fantastic! You've successfully navigated creating and testing XML APIs with Spring Boot and Keploy. Keep exploring, experimenting, and innovating! If you have any queries, we're here to help! + +import GetSupport from '../concepts/support.md' + + diff --git a/versioned_docs/version-2.0.0/running-keploy/configuration-file.md b/versioned_docs/version-2.0.0/running-keploy/configuration-file.md index 6e70a788e..ee6860b10 100644 --- a/versioned_docs/version-2.0.0/running-keploy/configuration-file.md +++ b/versioned_docs/version-2.0.0/running-keploy/configuration-file.md @@ -270,6 +270,8 @@ Earlier the only way to add the [noisy fields](http://keploy.io/docs/concepts/ge The `global subsection` of `globalNoise` is used to define parameters that are globally ignored for all API calls during testing. It enables you to filter out consistent noise, ensuring a cleaner evaluation of responses. +**Note** - The examples below support both the xml as well as the json type responses. + ```yml globalNoise: global: {body: {