Step 4: Test an Expired OTP

Generate an OTP and wait until its configured validity period has passed.

For example, if the test environment uses a two-minute expiry period, attempt verification after that period.

Expected behavior:

For repeatable testing, use a configurable expiry time or a controlled test clock where possible instead of relying only on manual waiting.

Step 5: Test OTP Resend Functionality

Call the resend endpoint, if the application provides one.

Check whether:

Some systems allow multiple OTPs to remain valid for a short period. Therefore, confirm the intended behavior before marking a test as failed.

Important OTP API Test Cases

The following test cases cover common functional, negative, boundary, and security scenarios.

Test scenarioExpected result
Request OTP with a valid mobile numberRequest is processed as specified
Request OTP with an invalid mobile numberRequest is rejected or handled according to the API contract
Request OTP with a missing mobile numberValidation error is returned
Submit the correct OTPVerification succeeds
Submit an incorrect OTPVerification fails
Submit an expired OTPVerification fails
Submit an OTP that has already been usedReuse is rejected when single-use behavior is required
Submit an OTP with fewer digits than expectedRequest is validated according to the OTP format
Submit an OTP with extra digitsRequest is validated according to the OTP format
Submit letters or special characters instead of digitsInvalid input is handled correctly
Request an OTP repeatedlyRate limits and resend rules are enforced
Exceed the allowed verification attemptsFurther attempts are restricted according to policy
Submit a request without the required fieldsAppropriate validation response is returned
Submit malformed JSONRequest is rejected safely
Verify an OTP for a different user or requestVerification is rejected
Reuse a request ID with a different OTPThe API follows the documented request-binding rules
Send requests concurrentlyNo unexpected duplicate verification or race condition occurs
Check the API response for sensitive informationOTPs and unnecessary personal data are not exposed

These cases should be adjusted according to the application’s requirements. For example, a system may use a six-digit numeric OTP, while another may use a different format.

Pages: 1 2 3 4 5 6 7 8 9

Leave a Reply

Your email address will not be published. Required fields are marked *