About me

Wednesday, August 24, 2011

Input Data Validation



Every web application is expected have at least one submit form. Data entered in form is transferred as input to database or to any other application and will decide the output. So, input data plays a very important role in retrieving the output data.

Such data needs to be validated by the code. And tester has the responsibility of validating such data.
At this point tester thinks about how can the validations be done and what type of data should be provided to validate the input field. Test data needs to be created and passed to the form through the automation tool or manually.

Here are few steps or guide lines to validate the data.

Let’s consider a sample form which acts as input to signing in as new member in a social networking site like facebook. It contains different types of input fields – Numeric, String, Alpha Numeric, date, preset values (from drop downs or check boxes), file uploads and Email addresses.

Name: String input field
Password : Alphanumeric field
Age: Numeric input field
Address: Alpha numeric
Date: Date of Birth
Email Address: Email field
Profile Image: Photo of the member: File upload

Validations which can be performed on such forms are

1.      Name :
a.       Should start with letter
b.      Should not contain numbers.(unless proposed)
c.       Should contain string characters only.
d.      Can contain underscore (_) ,hyphen  (-) and single quotation (')
e.      Can contain space but along with string characters
2.      Password :
a.       Should be encrypted with any special character and should not be visible even to the person who is entering it. Generally it gets skipped from encrypting when it is passed through any testing tool.
b.      Can contain string characters, numerical and special characters.
c.       Should not contain only spaces
d.      Length factor should be tested.
3.      Age :
a.       Should start with number
b.      Should not contain characters
c.      Should contain numbers only
d.      Should not contain special characters and spaces also
e.      Should not have all zeroes or single 0
4.      Address :
a.       Can contain string characters, numeric, special characters.
b.      Should contain only spaces
c.       Should not contain junk data, it should be meaningful
5.      Date :
a.       Can contain numbers
b.      Can contain special characters like hyphen (-),slash(/) depending on format accepted
c.        Can contain string characters depending on format
d.      Some cases should not accept future date like for date of birth we cannot put future date.
e.      Some cases should not accept past date like for any activity which is planned for future date.
6.      Email Address :
a.       Can contain numeric, string and special characters
b.      Should not contain only special characters or numbers
c.       Should not contain only spaces
d.      Should contain at least one at symbol (@)
e.      Should contain at least one dot (.)
7.      Profile image :
a.       Should be a path to the file which is to be uploaded
b.      File should be existing
c.       File format should be acceptable with the input field
d.      File size should be in the limits mentioned
8.      Apart from above we should also check the following in the input provided
a.       Length acceptable in the field
b.      Minimum length criteria is accepted or not
c.       Is the field mandatory ---then input is must and no spaces and all zeroes should be accepted.
d.      More number of spaces provided at the end or in between or at start of the data should be trimmed.
e.      Data in the form of SQL queries should not be accepted as they are provided to break the security system by hackers.
f.        Date which has HTML tags should not be provided. As they might be interpreted in different form when submitted as input data.


Points to be noted by developer when submit forms are designed

1.       Highlight the mandatory fields either by asterisk (*) or text “Mandatory” or coloring the text box in differentiating color.
2.       Mention the acceptable format near the date field.
3.       Mention the max length for the input fields which has limit restrictions.
4.       SQL queries should be identified and rejected.
5.       Same with HTML tags, they should be identified before passing the data.
6.       Errors should be in red. Or fields which have incorrect data should be highlighted in red.
7.       Provide the error message near each error field. Or provide all the errors in one section of the page mentioning the data field names clearly.


Tuesday, August 23, 2011

Bloggers day

Lets celebrate Bloggers day on August 31st.


Get ready with the 5 new blogs which you like to recommend to others.


Why is August 31st selected as bloggers day?


August 31st means '3108' which resembles 'Blog'.


For more details of it visit the site http://www.blogday.org/