Verify API handles complex user creation scenarios
Preconditions (3)
Step 1: Open Postman and create a new POST request to the user creation API endpoint
Step 2: In the request body, enter a JSON payload with valid username, email, password, multiple roles, and nested metadata
Step 3: Send the request
Step 4: Verify the response status code is 201 Created
Step 5: Verify the response body contains the created user's id and matches the sent data
Step 6: Repeat the request with missing required fields and verify the API returns 400 Bad Request with appropriate error messages
Step 7: Repeat the request with invalid email format and verify the API returns 422 Unprocessable Entity
Step 8: Repeat the request with duplicate username and verify the API returns 409 Conflict
✅ Expected Result: The API correctly handles complex user creation scenarios by returning appropriate status codes and response bodies for valid and invalid inputs.