Sunday, January 22, 2012

Test Case


1. What is a test case?
“A set of test data and their expected results.

2. Why we write test cases?
To validate the testing coverage of the application.

3. How to write test cases (Example of test case or Sample of Test Case)?
There is no particular formula for  writing the test case. Basic elements used in the test case are:
a. Test case number: 1 OR 1.1
b. Test Case Name: Login Verification
c. Test case Inputs or Steps or Action: Enter Login credentials, Click on “login” button.
d. Test Case Expected result: Verify that user is successfully login to “Home” page.
e. Test Case Status: Pass or Fail.
f. Comments: If test case is fail the you can write why it is failed. Also you can write bug number here which you are going to be reporting.

You should ask your self a question before writing the test case "What should be the steps followed by different users to use this functionality". Surely you will get the answer and just you have to write that answer in the form of points in excel sheet. Those points will automatically become test cases :)

Writing effective test cases is a skill and that can be achieved by some experience and in-depth study of the application on which test cases are being written.

4. What is the suitable time to create Test case?
There are levels in which test cases should be analized/designed to avoid duplication efforts.

Level 1: In this level tester should write the basic test cases from the available specification documentation.
Level 2: This is the practical stage in which writing test cases depend on actual functional and system flow of the application.
Level 3: This is the stage in which tester should group some test cases and write a test procedure. Test procedure is nothing but a group of small test cases.

5. Automation vs Manual Test Cases
The following types of test cases can be preferred for automation:
a. Test cases that need to run on every build.
b. Test cases that use multiple data values for same action.
c. Identical test cases that need to be executed using different browsers.

The following types of test cases should not consider for automation testing:
a. Test Cases that will only be executed once.
b. Test Cases used for Ad-hoc/random Testing.
c. Test Cases that are infrequently selected for execution.
d. Test Cases that will require manual intervention i.e. a task not possible to automate.
e. Based on the intuition and knowledge of application. Eg. if you find that you cannot escape from manual intervention.


6. Examples

1. Basic Test Cases for Fan 1. It should have a hook for hanging in the roof.
2. It should have minimum three blades.
3. It should be moving once the electricity pass into it.
4. Speed of the fan should be controlled by the regulator.
5. It should be stop once the electric switch off.
6. The fan should run with minimum noise.
7. The blades should have proper distance from the ceiling.
8. The fan while in motion, should not vibrate.
9. The color of the fan should be dark.

10. Fan should work in clock-wise direction

2. Basic Test Cases for Credit Card Case 1: Check for invalid Characters in Credit Card.
Description: Enter invalid characters @@@@34534"asd".
Expected Result: Error message should appear informing that invalid value is entered.

Case 2: Check for wrong Credit Card type.
Description: Enter invalid Credit Card type e.g. Enter Am Ex in place of VISA.
Expected Result: Error message should appear informing that invalid Credit Card is entered.

Case 3: Check for wrong Expiry Date.
Description: Select wrong month & year of expiry date.
Expected Result: Error message should appear informing that invalid Expiry date has been entered.

Case 4: Check for CVV number with the invalid characters as well as with the alphabetic & alpha numeric values.
Description: Enter invalid CVV number. Like: ABC or a3c. or @@" or "1".
Expected Result: Error message should appear information. Invalid characters are entered.

Case 5: Check for validation messages while enter wrong billing information.
Description: Check for Maximum & Minimum value acceptance. Check for invalid Characters. Check for Numeric value acceptance where numeric values are required & vice-versa.
Expected Result: Error message should appear while enter invalid values.


3. Basic Test Cases for Printer 1) Open page setup by selecting File>Page Setup
Expected Result: Page Setup dialog appears

What to Print
2) In Page Setup, select Orientation = Portrait, Margins = 10 for Top, Bottom, Right, Left. Click OK.Expected Result: Error: “The margins overlap or they are off the paper. Enter a different margin size.” Click OK

3) Now select Orientation =Landscape
Expected Result: Notice that all margins are automatically reset to default values.

4) In Page Setup, click on Printer. In Printer, select a printer from the Name list., then click on Properties. Expected Result: Verify that the selected printer's name is displayed as part of the title of Document Properties popup.


5) In Document Properties, leave defaults as is (Portrait, None, Front to Back). On the Layout tab, click OK to close all popups belonging to Page Setup. File>Print. In Print, click on Properties. In Document Properties, select Landscape, Flip on Long Edge, and Pages Per Sheet = 2.. Click OK
Expected Result: Notice that printout is based on the settings in File>Print, i.e. This setup override the one in Page Setup.

Miscellaneous Cases:
6) Make changes to the setting and click the Default button
Expected Result: Settings should revert to defaults


7) Switch to a different printer
Expected Result: When printed, the diagram should be sent to alternate printer

8) Switch to the plotterExpected Result: When printed, the diagram should be sent to the plotter


9) Switch to a color printer
Expected Result: When printed, the diagram should be sent to the color printer

10) Change the paper size
Expected Result: When printed, the diagram should appear on the correct paper size

11) Switch to portrait orientationExpected Result: When printed, the diagram should appear in portrait orientation


12) Switch to landscape orientation
Expected Result: When printed, the diagram should appear in landscape orientation


Other Printer Test Cases:
Case 1: Ensure correct behavior of application with Print functionality.
Steps:
1. Verify that printer is connected with machine.
2. Open the application and click on Print. Verify printouts in all the views.

Case 2: Ensure that application behaves correctly if printer is not available. Steps:1. Verify that no printer is connected with machine. 2. Open the application and click on Print. 3. Verify that proper message appears for printer unavailability.

Case 3: Ensure that application queues prints in printer if papers are not available in printer.
Steps:
1. Verify that printer is connected with machine. 
2. Verify that no papers are available. 
3. Open the application and click on Print. Verify that all the prints which were in queue.

Case 4: Ensure correct behavior of application if printer is uninstalled. 
Steps:
1. Verify that printer is uninstalled from machine.
2. Open the application and click on Print.
3. Verify that proper message appears for printer unavailability.

Case 5: Ensure correct behavior of Print functionality with new installed printer. Steps:
1. Verify that printer is uninstalled from machine. 
2. Now, install printer on machine. 
3. Open the application and click on Print. 
4. Verify printouts in all the views.

4. Basic Test Cases for Paging Functionality Condition: Qty available is given and we have to fill Qty we want (Reffer iReuse.com paging)

Test Case 1:
1. Try to enter Qty we want more than Qty available (this should not happend).
2. Try to enter alphabets (this should not happend).
3. Submit without entering anything.
 
Test Case 2:
1. Select page 1 enter items.
2. select page 2 enter items.
3. Click again on page 1 and see if this remembers same entered items.
4. Click again on page 2 and see if this remembers same entered items.
5. Submit, check the email and match result.
 
Test Case 3:
1. Select page 1 do not enter items.
2. select page 2 enter items.
3. Click again on page 1 and now enter items.
4. Click again on page 2 and see if this remembers same entered items. Then change some items.
5. Submit, check the email and match result.
 
Expected critical errors: Sometime items exchanged the values from different pages.


5. Test Cases for Upload Images 1. Upload files with extensions like .jpg, .jpeg, .gif, .png, .bmp).
2. Upload files with extensions like .jPg, .JpeG, .GIf, .pNg, .bmP).
3. Upload files with extensions like .JPG, .JPEG, .GIF, .PNG, .BMP).
4. One thing we have to keep in mind while testing files uploading that we also should have to test files with long names.

Note: I had received the server error when uploading with long file name while functionality was working file with small filename. Also I received the server error when used .JPG, but application was working fine with extension .jpg.

No comments: