Skip to content

Latest commit

 

History

History
79 lines (60 loc) · 4.01 KB

QQE-379.md

File metadata and controls

79 lines (60 loc) · 4.01 KB

QQE-379 - HTTP module / REST use-cases - Development topics - JSON payload

Links

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.

Scope of the testing

  • 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.

What to test

Successful JSON payload processing:

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.

Check large JSON with complex structures payload processing:

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 and GET
  • 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.

Handling invalid JSON payloads:

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.

Handling missing or incorrect data types:

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.

Testing with special characters 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.

Testing of incorrect Content-Type :

Test requests with incorrect Content-Type headers should fail gracefully.

  • HTTP Method: POST
  • HTTP Status Code: Expect 415 Unsupported Media Type.

Getting Familiar with the Feature:

  • 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.

Links to the resources

Impact on resources

  • 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.

Contacts