Jira : QQE-379
TD: quarkus-qe/quarkus-test-suite#1890
This test plan outlines the testing for different JSON payloads in Quarkus REST endpoints. It aims to ensure the correct handling of JSON data in various scenarios, including successful processing, invalid payloads, error handling, and complex data structures.
- The test coverage will be verified for environments: JVM, native mode and Openshift.
- Libraries used: quarkus-rest-jsonb
- Payloads: valid, invalid, large, complex, missing/incorrect/empty/null data types, special characters.
Verify that Quarkus REST endpoints successfully process valid JSON payloads.
- Payload: simple json file.
- HTTP Method:
POST
- Deserialization: Ensure accurate conversion of JSON payloads, that it's performed using the configured Quarkus JSON-B library (quarkus-rest-jsonb).
- HTTP Status Code: Expect
201 Created
upon successful payload processing. - Response Content: Validate that the response contains the expected message.
Verify that the application can efficiently process large JSON payloads containing nested objects, arrays, and various data types without issues.
- Payload: large json file.
- HTTP Method:
POST
andGET
- Deserialization: Ensure accurate conversion of JSON payloads, that it's performed using the configured Quarkus JSONB library (quarkus-rest-jsonb).
- HTTP Status Code: Expect
201 Created
upon successful payload processing. - Response Content: Validate that the response contains the expected message.
Test how the application responds to malformed or invalid JSON requests ensuring appropriate error responses are returned.
- Payload: json file without commas between objects, extra strings, etc.
- HTTP Method:
POST
- HTTP Status Code: Expect 500 Internal Server Error for invalid JSON payload.
Validate the behavior when required JSON fields are missing or have incorrect, empty, null data types, ensuring proper error handling.
- Payload: json file with empty and null json object's fields.
- HTTP Method:
POST
- HTTP Status Code: Expect 500 Internal Server Error for invalid JSON payload.
Validate the application's response to JSON payload containing special characters.
- Payload: Create a JsonObject with special characters.
- HTTP Method:
POST
- HTTP Status Code: Expect 201 Created.
Test requests with incorrect Content-Type headers should fail gracefully.
- HTTP Method:
POST
- HTTP Status Code: Expect 415 Unsupported Media Type.
- Review Quarkus documentation: understand the Quarkus REST guides and its JSON serialization/deserialization mechanisms.
- Explore RESTEasy reactive: Dive into the specifics of RESTEasy Reactive, the underlying implementation of Quarkus REST, paying attention to its handling of JSON payloads and integration with Jackson or JSON-B.
- Examine code examples: Analyze code provided in the Quarkus repositories to gain practical insights.
- Hands-on experimentation: Create sample Quarkus REST endpoints and experiment with different JSON payloads to observe the behavior.
- On JVM, tests increase execution time of the module http-advanced-reactive up to 1 minutes.
- On Native, JsonBPayloadIT 02:49 min.
- On Openshift, tests takes 02:31 min.
- Tester: Jose Carranza [email protected]