Tuesday, July 28, 2009

Testing School - Test cases for first name, last name , mailID, Landline number in registration form

Testing of First name and last name

Examples of field validation criteria are:

  • First and last name fields are required.
  • First and last name fields are limited to 50 characters each.
  • First and last name fields will not accept numbers.
  • First and last name fields will not accept the following characters: `~!@#$%^&*()_:";'{}[]+<>?,./

Consider the following example:

Registration Form

Enter your first and last names and click the Submit button.

First Name:

Last Name:

Submit

Here’s a set of test cases that include validation criteria:

1. Launch an IE browser and go to the Registration Form.

2. Verify the registration page opens.

3. On the registration page, click the mouse in the First Name field.

4. Leave the First Name and Last Name fields blank and click on the Submit button.

5. Verify an error message appears saying you cannot leave the First Name and Last Name fields blank.

6. Enter 50 characters in both the First and Last Name fields.

7. Verify the names are accepted.

8. Enter more than 50 characters in both the First and Last Name fields.

9. Verify an error message appears saying you cannot enter more than 50 characters in the First Name and Last Name fields.

10. Enter numbers in the First and Last Name fields.

11. Verify an error message appears saying you cannot enter numbers in the First and Last Name fields.

12. Enter the characters "`~!@#$%^&*()_:";'{}[]+<>?,./" in the First and Last Name fields.

13. Verify an error message appears saying you cannot enter "`~!@#$%^&*()_:";'{}[]+<>?,./" characters in the First and Last Name fields.

14. Type “Aman” in the First Name field.

15. Click the mouse in the Last Name field.

16. Type in “Kumar” in Last Name field.

17. Click on the Submit button.

18. Click on registration List in the left nav bar.

19. Verify the Name “Aman Kumar” is now present in the registration list.

For example, the blank name validation should be tested like this:

1. Leave the First Name and Last Name fields blank and click on the Submit button.

2. Verify an error message appears saying you cannot leave the First Name and Last Name fields blank.

3. Enter a valid First Name and leave the Last Name field blank and click on the Submit button.

4. Verify an error message appears saying you cannot leave the Last Name field blank.

5. Enter a valid Last Name and leave the First Name field blank and click on the Submit button.

6. Verify an error message appears saying you cannot leave the First Name field blank.

As you can see, this increases the number of test cases needed substantially, and even this set of test cases leaves certain issues untested.

For instance, the form should also be tested for resistance to what is known as HTML insertion attacks. If not handled properly, HTML code entered into a field will be displayed on the page when the submit button is clicked. Most code written now will handle insertion attacks, but it's always a good idea to verify that. Here's a test case for insertion attacks:

1. Enter the text "This is a test! " in the First Name field and hit submit.

2. Verify the text "This is a test!" does not appear on the registration page.

Testing of email Id:

Here is the list of valid and invalid email format which can
be used for testing
 
 
Valid Email address                                       Reason
 
email@domain.com                     Valid email
firstname.lastname@domain.com         Email contains dot in the address field
email@subdomain.domain.com             Email contains dot with   subdomain
firstname+lastname@domain.com          Plus sign is considered valid
                                      character
email@123.123.123.123                 Domain is valid IP address
email@[123.123.123.123]              Square bracket around IP address is considered valid
"email"@domain.com                 Quotes around email is considered  valid
1234567890@domain.com              Digits in address are valid
email@domain-one.com               Dash in domain name is valid
_______@domain.com                 Underscore in the address field is valid
email@domain.name                  .name is valid Top Level Domain name
email@domain.co.jp                 Dot in Top Level Domain name also
                                   considered valid (use co.jp as example here)
 
firstname-lastname@domain.com       Dash in address field is valid
 
 
 
 
 
Invalid Email address                                     Reason
 
plainaddress                           Missing @ sign and domain
#@%^%#$@#$@#.com                       Garbage
@domain.com                            Missing username
Joe Smith            Encoded html within email is
                                      invalid
email.domain.com                       Missing @
email@domain@domain.com                Two @ sign
.email@domain.com              Leading dot in address is not allowed
email.@domain.com              Trailing dot in address is not allowed
email..email@domain.com               Multiple dots
あいうえお@domain.com  Unicode char as address
email@domain.com (Joe Smith)        Text followed email is not allowed
email@domain              Missing top level domain (.com/.net/.org/etc)
email@-domain.com         Leading dash in front of domain is invalid
email@domain.web          .web is not a valid top level domain
email@111.222.333.44444                Invalid IP format
email@domain..com          Multiple dot in the domain portion is invalid

Testing of Landline phone in registration form:

In India, there are a number of valid formats for phone numbers that might be entered into a form:

nnnnnn                                234567
nn-nnnn-nnnnnn                        95-6543-234567              
nnnnn-nnnnnn                          06543-234567
nn-nnnn-nnnnnn                        91-6543-234567

There are many other variations of this, as well, but those examples should be enough to give you an idea of what we're dealing with here. Because there are so many valid formats, you're going to have to set some rules for reformatting these phone numbers:

1. All numbers will at least be in the format nn-nnnn-nnnnnn. Numbers entered without area codes will have a default area code prepended to them.

2. Any extensions will be listed as nnnnnn following the phone number.

3. If an initial 91 is added to the number, it will be removed, since users already know to dial a one before making a long distance call.

No comments:

Post a Comment