Here are some of the sample test cases for Text Box or Text Area control.
Check for the alpha characters or alpha numeric characters
Check for alphabet is accepted in upper and lower case both
Check the mandatory condition for the textbox if given
Check the textbox is blank or not by default
Check Max-Min character limit of text box
Check for numeric characters only including negative and decimal values
Check with the requirement whether it will accept numeric and special characters
Check by entering ”HTML tag” such as <H1> Hello </H1>and links
Check by entering “Java Script” such as alert("hello");
Check by entering “Spaces” in the prefix and suffix of the entered character-Trimming of space
Check by entering “single quotes and double quotes”
Check Copy and Paste long texts from word or notepad
Check the height and alignment of text boxes are same throughout the site
Check drag and drop image in text box
Check text box except only spaces as input
Check the zip code text field with string instead of numbers.
Check the zip code text field with numbers shorter than required.
Check Tab validation is working or not
Check mousehover functionality
Check tool tip and water mark in the text box
Check Grammar and Spelling in confirmation message
Check the text box accepts formatted numbers/string such ##/##/#### or ##.## etc.,
Check the text box immune to SQL injection
Check the cursor appears while typing the content in the text box
Disabled TextBox:
1. Check if any pre-populated value should be displayed as per requirement. 2. Check if you cannot edit disabled TextBox. 3. Check for conditions when that TextBox should be enabled. 4. Disabled textbox should not accept any value. 5. Check for cursor should not be displayed in disabled TextBox. 6. Disabled TextBox should be grayed out.
Enabled TextBox: 1. Check for pre-population of any value or BLANK value as per requirement. 2. Check for blinking cursor when get focused. 3. Check for RED asterisk for mandatory fields. (as per requirements) 4. Enter continuous characters still it stops to enter any character and measure width of the TextBox. It should stop you and width should be as per requirement. 5. Check for spaces and its combination with any characters. It should not allow only spaces. 6. Check for numbers and special characters like 1, 2, $, #, +, - etc. 7. Check for combination of alphabets, numeric, signs and special characters. 8. Enter valid value in mandatory TextBox and save the window. Again come to same window and delete that value and test if it asks for value as it is mandatory. 9. If value is coming from DB then check if you can edit same. 10. If value is coming from DB then check if the value is correct and populating correctly. 11. Check if DB accepting “Redundant” values. 12. Check if correct “Text” associated with TextBox. 13. Check for alignment of TextBox and Text associated with TextBox are proper as per other controls on window. 14. Check for “Formatted TextBox” which should have proper format predefined and accepting the same number characters in the same format for ex: SSN number should accept XXX-XXX-XXX in this format and - - characters should be displayed in TextBox before entering anything. 15. Check if “formatted” TextBox are not accepting less than the allocated characters. 16. Check if “Browser” button is associated with TextBox then same values which selected in “Browser” should be displayed and in its proper format. Also check for edit function for same as per business functionality. 17. Check for “Scrolling” option available if it accepting characters out of boundary. Also check for each Up and Down scroll is working properly. 18. If it has an option like after clicking on checkbox the TextBox should be disabled then check if already entered characters are get wiped off and TextBox should be disabled if clicked on such checkbox. 19. SHIFT and Arrow should Select Characters. Selection should also be possible with mouse. Double Click should select all text in box. 20. Move the Mouse Cursor over all Enterable Text Boxes. Cursor should change from arrow to Insert Bar.