Thursday 18 July 2013

Equivalence Class Partitioning with example


What is "Equivalence Class Partitioning"?

We define "Equivalence Class Partitioning" as a method that can help you derive test cases. You identify classes of input or output conditions. The rule is that each member in the class causes the same kind of behavior of the system. In other words, the "Equivalence Class Partitioning" method creates sets of inputs or outputs that are handled in the same way by the application.

Another definition taken from Wikipedia:
"A technique in black box testing. It is designed to minimize the number of test cases by dividing tests in such a way that the system is expected to act the same way for all tests of each equivalence partition. Test inputs are selected from each class. Every possible input belongs to one and only one equivalence partition."
Why learn "Equivalence Class Partitioning"?

This method drastically reduces the number of test cases that are required to be tested because we don't have time, money or manpower to test everything. In addition, it can help you find many errors with the smallest number of test cases.
How to use "Equivalence Class Partitioning"?

There are 2 major steps we need to do in order to use equivalence class partitioning:
  • Identify the equivalence classes of input or output. Take each input's or output's condition that is described in the specification and derive at least 2 classes for it:
    • One class that satisfies the condition – the valid class.
    • Second class that doesn't satisfy the condition – the invalid class.
  • Design test cases based on the equivalence classes.
Example 1
In a computer store, the computer item can have a quantity between -500 to +500. What are the equivalence classes?
Answer: Valid class: -500 <= QTY <= +500
                Invalid class: QTY > +500
                Invalid class: QTY < -500

Example 2
In a computer store, the computer item type can be P2, P3, P4, and P5 (each type influences the price). What are the equivalence classes?
Answer: Valid class: type is P2
                Valid class: type is P3
                Valid class: type is P4
                Valid class: type is P5
                Invalid class: type isn’t P2, P3, P4 or P5
Practice
Bank account can be 500 to 1000 or 0 to 499 or 2000 (the field type is integer). What are the equivalence classes?
Try to solve it before reading the answer.
Practice 1 - answer
  • Valid class: 0 <= account <= 499
  • Valid class: 500 <= account <= 1000
  • Valid class: 2000 <= account <= 2000
  • Invalid class: account < 0
  • Invalid class: 1000 < account < 2000
  • Invalid class: account > 2000
Equivalence Class Vs Boundary Testing

Let us discuss about the difference between Equivalence class and boundary testing. For the discussion we will use the practice question:
Bank account can be integer in the following ranges: 500 to 1000 or 0 to 499 or 2000. What are the equivalence classes?
Answer:
  • valid class: 0 <= account <= 499
  • valid class: 500 <= account <= 1000
  • valid class: 2000 <= account <= 2000
  • invalid class: account < 0
  • invalid class: 1000 < account < 2000
  • invalid class: account > 2000
In equivalence class, you need to take one value from each class and test whether the value causes the system to act as the class' definition. It means that in this example, you need to create at least 6 test cases – one for each valid class and one for each invalid class.
How many test cases will be, if you use boundary testing?
The following table shows how much test cases will be using "Boundary Testing" method:
Test Case #
Value
Result
1
-1 Invalid
2
0 Valid
3
1 Valid
4
498 Valid
5
499 Valid
6
500 Valid
7
501 Valid
8
999 Valid
9 1000 Valid
10 1001 Invalid
11 1999 Invalid
12 2000 Valid
13 2001 Invalid

In boundary testing, you need to test each value in the boundary and you know the value, you don't need to choose it from any set. In this example you have 13 test cases.
Now, let us exam how to combine this 2 methods together.
The following table shows all the boundary testing values and their equivalence classes:
#
Boundary Value
Equivalence Class
Result
1
-1 account < 0 Invalid 
2
0 0 <= account <= 499 Valid 
3
1 0 <= account <= 499 Valid 
4
498 0 <= account <= 499 Valid 
5
499 0 <= account <= 499 Valid 
6
500 500 <= account <= 1000  Valid
7
501 500 <= account <= 1000 Valid 
8
999 500 <= account <= 1000 Valid 
9 1000 500 <= account <= 1000  Valid
10 1001 1000 < account < 2000 Invalid 
11 1999 1000 < account < 2000  Invalid
12 2000 2000 <= account <= 2000 Valid 
13 2001 account > 2000 Invalid 

Now, we can reduce some of the test cases that belong to the same equivalence class. We can delete lines 3 and 4 which belong to equivalence class "0 <= account <= 499". We also can delete lines 7 and 8 hich belong to "500 <= account <= 1000". The new table will be:
#
Boundary Value
Equivalence Class
Result
1
-1 account < 0 Invalid 
2
0 0 <= account <= 499 Valid 
5
499 0 <= account <= 499 Valid 
6
500 500 <= account <= 1000  Valid
9 1000 500 <= account <= 1000  Valid
10 1001 1000 < account < 2000 Invalid 
11 1999 1000 < account < 2000  Invalid
12 2000 2000 <= account <= 2000 Valid 
13 2001 account > 2000 Invalid 
You can even reduce more test cases although in my opinion, it is important to keep this table because it keeps a hard connection to the boundary testing. You can see in the table that I didn't reduce those test cases that are touch in the boundary itself of each range.
Let's reduce more test cases (just for the fun and for the practice (test case 5, 9 and 10):
#
Boundary Value
Equivalence Class
Result
1
-1 account < 0 Invalid 
2
0 0 <= account <= 499 Valid 
6
500 500 <= account <= 1000  Valid
11 1999 1000 < account < 2000  Invalid
12 2000 2000 <= account <= 2000 Valid 
13 2001 account > 2000 Invalid 
Now, in this table, for each equivalence class, you choose one value that belongs to boundary testing.

Boundary Values Testing with example


What is “Boundary Values Testing”?
 
“Boundary Values Testing” is a method that tests the boundary whether it's an input, an output or a performance boundary. Our tests focus on the boundaries values and not on the entire range of data. We will use it when we have a field that can contain a range of values as an input, an output or as a requirement.

How to use “Boundary Values Testing”?
 
If you have a range: (a to b), you will test the following:

Test Case
Value
Expected Result
1
a-1
Invalid
2
a
Valid
3
a+1
Valid
4
b-1
Valid
5
b
Valid
6
b+1
Invalid

According to the ISTQB in "Boundary Values Testing" we only test the following:

Test Case
Value
Expected Result
1
a-1
Invalid
2
a
Valid
3
b
Valid
4
b+1
Invalid
Why ISTQB has less test cases, because we can say that if 'a' and 'a-1' are working well, then we can assume that 'a+1' is working well. The same claim will be about the upper bound. If 'b' and 'b+1' are working well, then we can assume that 'b-1' is working well.
Any option of implementing the "Boundary Values" method you will use is good. Instead of testing the entire range, you can tests 6 or 4 cases and still have confiedence that the software works well.
Here are some more rules from my experience that you can take in consideration:
  • Always test 0 if it is inside the range and sometimes even if it's out of range because 0 has special effect on software (like dividing in 0).
  • Always test the empty string if it is inside the range and sometimes even if it's out of range.
  • Sometimes you can test a value that exists inside the range and not in the boundary just in case…(It allows you to sleep deeper at night…).
Now, let us practice the "Boundary Values Testing" method.
Practice 1
You are testing inventory software that contains a field of the quantity of items. The field can contain any value between 10 to 100 units.
  • What is the max number of test cases you will need in order to test the field?
  • What is the minimum number of test cases you will need in order to test the field, using boundary testing?
Try to solve it and then continue to read the answer.
Practice 1 - answer
The field contains a range of 10 to 100 (10-100).
  • The max number of test cases you will need in order to test the field will be 93 test cases (9, 10, 11, 12…97, 98, 99, 100, 10) or 94 test cases if we include the value of 0.
  • The minimum number of test cases you will need in order to test the field, using boundary testing will be 6 test cases (9, 10, 11, 99, 100, 101) or 7 test cases if we include 0.
  • Note that we need to add more tests like alphabetic chars and special chars like %, *.
Practice 2
You have a password field that can contain up to 8 characters and must have at least 3 characters. What is the minimum number of test cases you will need in order to test the field? (Pay attention to the requirement that specifies the field's length and not what kind of chars it can get! In the real world we can't ignore it but in order to simplify the example we will ignore it).
Try to solve it and then continue to read the answer.

Practice 2 - answer
6 test cases: length 2, length 3, length 4, length 7, length 8, length 9 or 7 test cases Length 2, length 3, length 4, length 6, length 7, length 8, length 9. We can add a test case that test the empty string. 

Practice 3
You have a field that can contain up to 5 digits and can have 0 digits. The value of the field can be in the range of (-5148 to +3544) What is the minimum number of test cases you will need in order to test the field using "Boundary" testing?
Try to solve it and then continue to read the answer.

Practice 3 - answer
  • For the length we have 5 test cases: 0 length, 1 length, 4 length, 5 length and 6 length.
  • For the range we have 7 test cases: -5149, -5148, -5147, 0, +3543, +3544, +3545.
  • Total of 12 tests cases.
we reduce the amount of test cases to be less then 12 (try to solve it and continue to read)?
Well, we can reduce it to 10 test cases by combine the value testing of the field with the length testing of the field.
Case # Length Value Expected Result
1 0 None Valid
2 1 0 Valid
3 4 3543 Valid
4 4 3544 Valid
5 4 3545 Invalid
6 5 -5149 Invalid
7 5 -5148 Valid
8 5 -5147 Valid
9 6 123456 Invalid
10 6 -45322 Invalid
This was an example of why you must use your head all the time, because sometimes you can combine methodologies with each other or combine them with your common sense and reduce the amount of testing or create smart tests that will reveal beautiful and important bugs.

Smoke , Sanity and difference between Sanity and regression testing.

Smoke Testing:-

1) Smoke testing basically known as the build verification testing.
2) Smoke testing is used to check the critical functionality working fine or not.
2) In smoke testing we check that the build is ready for the further testing or not.
3) Basically it is a tested by the developer, but in most of companies tester perform this task.
4) Smoke testing is used to avoid the time for the further testing.
5) If build pass the smoke test, then the build is ready for the further testing.

Example :- Supposes I have to test the  user dashboard, when I am logged in into the application blank page being displayed. So smoke test is fail and build should not be ready for the further testing.


 Sanity Testing:-

1) Sanity Testing is also a kind of build verification testing.
2) In sanity testing is performed to check that the bug have been fixed and no further issues are introduced due to these changes.
3) Sanity testing is perform by the testers.
4) Sanity testing is subset of Acceptance testing, it is also known as tester acceptance testing.

Difference Between Sanity and Regression Testing 

Sanity testing is basically the basic testing to accept the build for detailed testing.
Regression testing is testing the impact of changes after bug fix or after any change in the application or the environment.
Example:-  
Supposes I have edit profile page for the regression testing. But when I logged in into the application, blank page being displayed. Means no need to test the advanced testing because sanity is fail.  

Friday 1 February 2013

Standard messages for Testing

Why standard messages document is needed ?

Currently we are not following any standardized format of messages in any of our projects.         





MESSAGES





1.LOGIN







      1.     
When the users tries to login without giving username & password
You must enter a valid Username & Password







      2.       
When password is not given
You must enter a valid Password






      3.       
When wrong user name is given & correct password

You must enter a valid Username & Password







      4.       
When correct user name & wrong password is given






      5.       
When both the user name & password are wrong






2.CHANGE PASSWORD






      6.       
When old password is incorrect
Please  check your old password






      7.       
When old password is correct & new password & confirm password is not similar.

Passwords mismatch between new & confirm password. Please try again.






      8.       
When no values are entered & submit button is clicked
Please enter old password & new password.





      9.       
Enter old password & click submit  button without entering new password & confirm password
Please enter new password & confirm password
   





     10.     
Enter New  password & confirm password, then Click on the submit button without entering old password
Please enter the old password.





     11.     
If some special characters are not allowed, show the message just below the text box.

Please note that the special characters (specify the special characters) are not allowed.






     12.     
If space is not allowed in password. Enter the password with space.
Please note that space is not allowed





     13.     
If the number of characters chosen for password is less than the minimum length

Your password must contain at least ‘x’ characters.






     14.     
If the number of characters chosen for password is more than the maximum length
 You have exceeded the character limit








3. FORGOT PASSWORD






     15.     
In case of forgot password
Password reset instructions were sent to your e-mail address/The new password will be sent to your e-mail address






     16.     
 Without entering the email id(User Name) & click submit button
Please enter your Email Address below
Password reset instructions were sent to your e-mail address/ The new password will be sent to your e-mail address






     17.     
In case of email id ,enter an invalid mail id and click submit button
Please make sure that the e-mail id is entered correctly.








4. REGISTRATION






     18.     
If the user name already exists
Sorry, the username ‘abcd’ is already registered.
Please try again.






     19.     
If some special characters are not allowed, show the message just below the text box.

Please note that the special characters (specify the special characters) are not allowed.





     20.     
Validation message if mandatory fields are not entered
Fields marked with an asterisk (*) are mandatory
 





     21.     
If the number of characters chosen for Username/password is less than the minimum length

Must have at least ‘x’ characters.
Your password /username  must contain at least ‘x’ characters.





     22.     
If the number of characters chosen for Username/password is more than the maximum length

The value has exceeded the  maximum length
Or
Please note that only ‘x’ characters are allowed.
Or
You have exceeded the character limit





     23.     
When space is not allowed in password

Please note that space is not allowed





     24.     
If wrong image verification code is given
The characters you entered didn’t match the word verification. Please try again
or

The image verification code you entered is incorrect. Please try again






     25.     
Suppose If there are multiple conditions like 5-15 chars are required & special characters except underscore are not allowed then the message should come as

Please note that the character limit is between 5 and 15. Special characters except underscore (_) are not allowed.





     26.     
In case if age is given as a criterion for registration.
For e.g.: Only a person who is 18 or above can register in a site. In such case validation is required


Sorry! You are not 18 yet. Registration failed!






5. EMAIL






     27.     
When no messages are available in any of the folders
The folders are empty.





     28.     
After sending a message
Your message has been sent!





     29.     
While composing, if email address is not valid
Please enter  a valid email address





     30.     
Deleting messages from the folder
‘X’ message (s) deleted.
Or
  Message(s) deleted





     31.     
Moving messages from 1 folder to another.
‘X’ message (s) moved to ‘Folder name’.





     32.     
While deleting message/messages?
Are you sure you want to delete the selected item(s)?





     33.     
If no items are selected and delete button is clicked
You must select at least one message. Please try again.





     34.     
While deleting all items from a folder
Are you sure you want to permanently delete the selected item(s)?





     35.     
When editing information in an email account
Your account information has been updated





     36.     
If cancel button is clicked after entering edit page
Your account details have not been changed.





     37.     
In case of email id ,enter an invalid mail id and click submit button
Login failed for user 'username'. You might have entered an incorrect username or password. Please try again.






     38.     
If a message has to be sent to multiple persons and some of the ids entered are wrong
The email address (id) is not valid or
Invalid email address.







6. IMAGE GALLERY






     39.     
Deleting an image
Are you sure you want to delete the selected image(s)?





     40.     
When no images in an album
This album is empty





     41.     
When there are no images in gallery
No image exists





     42.     
If the uploaded image is of incorrect format (ex. A doc file’s extension is changed as .jpg) or  If other formats are uploaded

Please upload a valid Image type( Please note that only images with extension as .jpg, .gif, .png, .bmp etc) can be uploaded





     43.     
If the size of images are large or less
Please note that images up to (specify the maximum length) only can be uploaded.






     44.     
Same case with video files also.







7. FILE UPLOADING






     45.     
When uploading incorrect format or  If other formats are uploaded
Please upload a valid file. ( Please note that only files with (valid extensions) can be uploaded)





     46.     
If the file size is large or less
Please note that files up to (specify the maximum length) only can be uploaded.





                                  
8. SEARCH






     47.     
If no results to display
Your search returned no results.





     48.     
In search if searching has to be done using Ages or dates.

* Message should be according to the situation.
Return date must occur after the depart date






     49.     
When there are results to display after search, show a message on the top as

‘No. of results’ results found.





     50.     
If pagination is available in search, and if 10 results are displayed on each page

Displaying 1-10 of 25 results of ‘search item’





     51.     
With out entering an item and click on the search button
Please follow the criteria to search.







9. BLOG






     52.     
When publishing a blog
Your blog post has been published successfully





     53.     
When posting a comment
Your comment has been posted.





     54.     
When deleting a comment
The comment has been deleted.





     55.     
When following a blog
You are now following ‘Blog name’.





     56.     
Deleting a blog
Are you sure you want to delete the blog
This will remove the associated comments






     57.     
If the user has not posted any blog & if he clicks on ‘my blog’
You have not created any blog post yet.





     58.     
If posting a blog from user side and will be displayed in user side only after approval of admin then
Thank you for posting your blog. It will be displayed only  after administrator's approval






10. FORUMS






     59.     
When posting a topic
Topic posted successfully





     60.     
When posting a comment
Comment posted successfully





     61.     
Deleting a forum topic
Are you sure you want to delete the ‘forum topic’
This will remove the associated comments





     62.     
If posting a forum from user side and will be  displayed in user side only after approval of admin then
Thank you for posting your forum. It will be displayed only after administrator's approval





     63.     
When deleting a comment
The comment has been deleted






11. POLL






     64.     
After casting votes.
Thank you for casting your vote





     65.     
Next time if the user goes for polling
You have already voted in this poll










12. COMMUNITY SITES






     66.     
If  no result for  a user/community etc
Sorry we were not able to find the ‘user/community’ on ‘URL of the site’





     67.     
If trying to post a new forum topic or trying to reply a particular topic without logging in.
Please log in to continue.





     68.     
Suppose an account is activated only after getting an email from the admin & the user has to confirm by clicking that mail. If a user tries to add friends, communities, blog etc before that (e.g.  MySpace)

You can add friends/communities etc only after logging in.

Please click on the confirmation link in the e-mail that you have received, to log in.





     69.     
Suppose an account is activated only after getting an email from the admin & the user has to confirm by clicking that mail. If a user tries to login before confirming. (e.g. Face book)

You can log in only after following the steps given in the confirmation mail.





     70.     
In case of forgot password
Enter your login email below. We will send you an email with a link to reset your password


Password reset instructions were sent to your e-mail address/ The new password will be sent to your e-mail address






     71.     
Joining a Group
Do you want to join ‘group name’?





     72.     
Un join a group
Are you sure to un join from ’group name’?





     73.     
In case of deactivating account
You can activate your account any time by logging in with your username & password.





     74.     
Deleting an account
Deleting an account will permanently remove all your profile information (like friends, images, videos, blog etc).Do you wish to continue?





     75.     
In case later if the user wants to re-register after deleting  & he has to start from the registration
Deleting an account will permanently remove all your profile information (like friends, images, videos, blog etc).






     76.     
Privacy/notification setting changed
Privacy/ notification settings changed successfully.





    
When there are no friends to display in friends list/category etc

Your friends list is empty.





     78.     
When there are no categories for friends
You don’t have any categories for friends.





     79.     
If message board/scrap book is empty
You don’t have any messages





     80.     
After posting message in message board
Message posted successfully.





     81.     
To block a user
Are you sure you want to block this user?





     82.     
Unblocking a user
Are you sure you want to unblock this user?





     83.     
Adding a user to friend’s list
Would you like to add ’username’ to your friend’s list?





     84.     
Deleting a friend from friend’s list
Are you sure you want to delete ‘username’ from friend’s list?





     85.     
Sending invitation to a friend
Would you like to invite ‘username’ to your friends list?






13. NEWSLETTER






     86.     
To subscribe for news letter
Do you wish to subscribe to the newsletter service?





     87.     
Unsubscribe from newsletter
Are you sure you want to unsubscribe






14. SPECIAL UPGRADE updates






     88.     
Subscribe to special upgrades.
Would you like to subscribe to the special upgrade offers?





     89.     
Unsubscribe special upgrade offers.
Are you sure you want to unsubscribe to the special upgrade offers?






15. GENERAL MESSAGES






     90.     
When deleting an item/items
Are you sure you want to delete the selected item(s)?





     91.     
When editing an item Details.
Details updated & saved successfully.





     92.     
When adding an item.(User, User details, Image, Video etc)
“Item(s)” added successfully.





     93.     
Dependency message: IF B is dependent on A & if A’s deletion deletes B also
Deleting A also results in deletion Of B. Are you sure you want to delete?





     94.     
Dependency message: If B is dependent on A & A can be deleted only if B is deleted
A cannot be deleted now. Please delete B first & then delete A.





   95
If administrator’s approval is required for completing a user registration
Thanks for registering. You will get a confirmation mail soon. You can log in only after following the steps given in the confirmation mail.





     95.     
If posting any comments in any site & that has to be validated by admin
Thanks for your comments. Your comments will be available only after administrator's approval






16. SUCCESS MESSAGES






     96.     
Password change
Your password has been changed





     97.     
Registration success
You have successfully registered (in case of job sites, matrimonial, exams).  Thank you for your interest in ……………..
 or
Congrats! Your registration is complete now.





     98.     
After registration in a community
Congrats! You are now a member of ‘Community name’.





     99.     
After making a payment
Payment has been successfully made





   100.    
After adding  ‘X’
‘X’ added successfully





   101.    
After editing ‘X’
‘X’ updated successfully.


References

1.      www.google.com 
2.      www.yahoo.com  
3.    www.aol.com
5.    www.mysapce.com
6.    www.blogger.com
7.    www.rediff.com



ISPG QA DEPT DOCUMENTS