In this post we’ll discuss test cases for text field. Every web or desktop application has the text input for it’s functionality. In order to test effectively we need to understand the purpose of the text field and the input being processed.
For this post we are going to discuss the different types of text fields, use cases and tools to test the text field. After that we’ll check some of the sample test cases for the text field. Feel free to comment any missing test case or test scenario.
Types of Text Field
Depending on the text field requirement in the form the input needs to be processed accordingly.
- Name field needs to only accept the alphabet values.
- Name field should not accept the numeric content.
- Name field should not accept the symbols.
- Card Number is a numeric field then it should only accept numbers.
- Card Number field should not accept characters and symbols in the input field.
- Forms with Credit Card number field only accept the specific numbers.
- Card number field should not accept the input more than the field needs.
- Credit and Debit card number field detects the card type based on the number.
- Card number field should also detect the debit or credit card type.
- Zip Code field should accept only the alphanumeric input from the users.
- Address field should allow characters, numeric and symbol input.
- Address field could be single or multi-line input box.
- Address may or may not be a mandatory field.
If the text box is not specified for the input. In such case it can accept numeric, text or symbols as it’s input. The test in such case has to be on the basis of the type of data that needs to be processed. For example Search engine accepts this type of input. However in order to process such content, search engine has input processing system. The tests then have to be made with respect to the content processing specifications.
Text Fields Use Cases
Where exactly do we use the text fields? The most common places where we use the text fields is the forms. The web form could be login form, contact form, registration form or any other data entry form. In case of document based forms, you may find such fields inside the PDF Forms. Mobile apps also have the forms embeded inside them. In case of apps you may notice the fields like username, password, phone number, contact address and name. Mobile apps also have custom text input for social status if used for social media. The SMS app or the messaging app also has the text field with specific limit. In case if you are testing desktop applications, you’ll find the text field in apps like Word, Notepad, skype, Gtalk and few other apps. Each desktop app has multiple or single text field within itself.
Tools to Test Text Field
There are different types of tools that can be used to test the text fields. Depending on what you’re testing, webapp or desktop app, you have to choose the tool accordingly.
Test Data
You can use the text generator tools like – Dummy text generator and Blind text generator. Most of the web designers also use lorem ipsum text generator as a placeholder text. Such dummy text generator is a good for test data.
Bug Magnet Chrome Add-on
This add-on is good for exploratory testing. It can be used to figure out the error handling, boundary-related errors, and security issues of your web-app. If your form has bunch of text fields then you should definitely choose this add-on to test.
Browser Developer Tools
Chrome, Firefox and Opera have a developer tools options installed by default. You can use the default developer tools to test the forms and other elements on the page. You can also check the fields for the different types of test data.
Test Cases for Text Field
Here are some of the test cases for the text field.
- How much is the maximum length of text field?
- How much is the minimum length of text field?
- How much input is expect in the text field?
- Does the text field allows input more than the textbox?
- Does the text field allows input less then the specified textbox?
- Does the textbox accepts numbers only?
- Does the textbox accepts decimal numbers?
- Does the textbox accepts formatted numbers?
- Does the textfield accepts alphabets?
- Does the textfield accepts uppercase alphabets?
- Does the textfield accepts lowercase alphabets?
- Does the textfield accepts mix of upper and lowercase alphabets?
- Is there any specific character that field allows?
- Is there any specific character that field doesn’t allow?
- Does the field accepts HTML characters?
- Does the text field accepts javascript?
- Does the text field immune to SQL injection?
- Does the text field allows copy paste?
- Does the text field allow drag and drop of text content?
- Does the cursor appears while typing the content?
- Does the text field allows spaces?
- Does the text field processes content with only spaces?
- Does the text field allows blank input?
- How does the text field manages trailing spaces?
- How does the text field manages leading spaces?
These are some of the test cases that you can use for text field. There are many types of text inputs so you have to test according to the specification. I hope these test scenarios and the pointers helped you. If you have any questions and suggestions, do let me know in the comments. I’d appreciate if you share the post on social media. 🙂