Interview #37: Design Test cases for a text field on a web form that accepts only integers between 1 and 100.

Interview #37: Design Test cases for a text field on a web form that accepts only integers between 1 and 100.

Designing test cases for a text field that accepts only integers between 1 and 100 requires careful consideration of valid inputs, invalid inputs, and edge cases to ensure the field behaves as expected under all scenarios. Here’s a detailed breakdown of the approach:

Disclaimer: For QA-Testing Jobs, WhatsApp us @ 91-9606623245

1. Understanding Requirements

  • Input Range: Only integers between 1 and 100 are valid.
  • Input Type: Non-integer inputs (e.g., letters, symbols) are invalid.
  • Validation Logic: Input should reject invalid values and provide appropriate feedback.
  • Additional Constraints:

  • Is the field required (no blank input allowed)?
  • What happens for leading zeros or large numbers?
  • How should the system handle whitespace around the input?


2. Designing Test Cases

A. Valid Input Test Cases

Typical Valid Values: Test representative integers within the range.

  • Input: 50, 75, 99
  • Expected Outcome: Accepted with no errors.

Boundary Values (Edge Case Valid):

  • Input: 1 (lower boundary), 100 (upper boundary)
  • Expected Outcome: Accepted with no errors.

Special Valid Input: Inputs with leading zeros.

  • Input: 001, 010
  • Expected Outcome: Treated as valid integers (1, 10).

B. Invalid Input Test Cases

Out-of-Range Numbers:

  • Below lower boundary: -1, 0
  • Above upper boundary: 101, 150
  • Expected Outcome: Rejected with appropriate error message.

Non-Integer Inputs:

  • Decimal numbers: 1.5, 99.99
  • Alphanumeric: abc, 12a
  • Special characters: @#$, *&^
  • Expected Outcome: Rejected with error indicating the input must be an integer.

Empty or Whitespace Input:

  • Input: (spaces), empty string
  • Expected Outcome: Rejected with an error indicating input is required.

Excessively Large Numbers:

  • Input: 1000, 99999
  • Expected Outcome: Rejected with error indicating input must be between 1 and 100.

C. Edge Case Test Scenarios

Boundary Testing with Invalid Values:

  • Just below the lower boundary: 0
  • Just above the upper boundary: 101
  • Expected Outcome: Rejected with a clear boundary-related error message.

Input with Leading and Trailing Whitespaces:

  • Input: " 1 ", " 50 "
  • Expected Outcome: Whitespace trimmed, value accepted as valid.

Stress Testing:

  • Very large input: 9999999999
  • Extremely long string of numbers: 12345678901234567890
  • Expected Outcome: Rejected to prevent crashes or performance issues.

Negative Numbers:

  • Input: -10, -100
  • Expected Outcome: Rejected with error indicating only positive integers are allowed.


3. Testing Methodology

Manual Testing:

  • Enter values directly into the field and observe behavior.
  • Verify error messages match requirements.

Automated Testing:

  • Write test scripts using tools like Selenium or Cypress.
  • Automate valid, invalid, and boundary input tests.

Exploratory Testing:

Test unexpected or unusual inputs (e.g., Unicode characters, emoji).


4. Test Case Format

Article content
Test cases for Text Box input combinations

5. Conclusion

Testing this input field involves a combination of boundary analysis, invalid input scenarios, and user behavior considerations. Writing comprehensive test cases ensures robust validation and a seamless user experience.

Article content


To view or add a comment, sign in

Others also viewed

Explore topics