Exam #3: API Testing - User Registration Endpoint
Prompt:
Generate API test cases for the user registration endpoint (POST /api/register) with the following requirements: Users must provide a valid email, password, and username. The password should be hashed, and the response should return a success message or an appropriate error message. Consider functional, negative, boundary, and security test cases.
Example Output:
• Verify that sending a valid email, password, and username returns a 201 Created response.
• Verify that sending an already registered email returns a 409 Conflict error.
• Verify that missing any required field results in a 400 Bad Request response.
• Verify that the password is not returned in the response.
• Verify that SQL injection attempts in the username field are blocked.
• Verify that sending an excessively long username (e.g., 300 characters) is handled properly.
• Verify that API rate-limiting prevents spam registrations.
• Verify that the system does not expose sensitive error details.
Last updated