Middle
How can boundary value testing be performed not on a numerical range, but on an alphabetical one?
sobes.tech AI
Answer from AI
Boundary value testing on an alphabetic range involves testing the first and last allowed characters, as well as characters immediately before and after the permissible range, if they exist in the character set.
For example, for a field accepting lowercase Cyrillic letters (а-я):
- Lower boundary:
- 'а' (the first allowed character)
- The character before 'а' (if applicable and exists in the encoding used)
- Upper boundary:
- 'я' (the last allowed character)
- The character after 'я' (if applicable and exists in the encoding used)
Additionally, the following can be tested:
- Empty string: ""
- String of one character: 'б' (any character within the range)
- String of characters outside the range:
- Latin: 'a', 'z'
- Digits: '1', '9'
- Special symbols: '$', '#'
- Uppercase Cyrillic: 'А', 'Я'
- String containing characters both inside and outside the range: "абвA1"
Testing involves submitting these values into the input field and checking the system's expected behavior: accepting valid values and rejecting (or correctly handling) invalid ones.
Example in Python code:
# Functionality for validating a string of lowercase Cyrillic letters
def validate_cyrillic_lowercase(text):
import re
return bool(re.fullmatch('[а-я]+', text))
# Test cases for boundary values
test_cases = {
"Lower boundary (first character)": ('а', True),
"Lower boundary (before range, invalid)": ('`', False), # Example character before 'а' in some encodings
"Upper boundary (last character)": ('я', True),
"Upper boundary (after range, invalid)": ('{', False), # Example character after 'я' in some encodings
"Inside range": ('абв', True),
"Empty string": ('', False),
"Latin": ('abc', False),
"Digits": ('123', False),
"Special symbols": ('@#$', False),
"Uppercase Cyrillic": ('АБВ', False),
"Mixed string": ('абвA1', False)
}
# Running tests
for description, (value, expected) in test_cases.items():
actual = validate_cyrillic_lowercase(value)
assert actual == expected, f"Test: {description}, Value: '{value}', Expected: {expected}, Got: {actual}"
print(f"Test '{description}' for value '{value}' passed.")