Interview Questions, Answers and Tutorials

Test cases and their examples

Test cases and their examples

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 the “log in” button.
d. Test Case Expected result: Verify that the user is successfully log in to the “Home” page.
e. Test Case Status: Pass or Fail.
f. Comments: If the test case is a failure you can write why it is failed. Also, you can write the bug number here which you are going to be reporting. You should ask yourself 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 on an 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 a Test case?

There are levels in which test cases should be analyzed/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 the actual functional and system flow of the application.
Level 3: This is the stage in which the tester should group some test cases and write a test procedure. The 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 the 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 a minimum of 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 stopped once the electric switch off.
6.The fan should run with minimum noise.
7. The blades should have a 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″and”.
Expected Result: An error message should appear informing that an invalid value is entered.

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

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

Case 4: Check for CVV number with the invalid characters as well as with the alphabetic & alphanumeric 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 entering 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 entering 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 the 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 the application behaves correctly if the printer is not available. Steps:1. Verify that no printer is connected with the machine. 2. Open the application and click on Print. 3. Verify that the proper message appears for printer unavailability.
Case 3: Ensure that application queues print in the printer if papers are not available in the printer.Steps:1. Verify that printer is connected with the machine. 2. Verify that no papers are available. 3. Open the application and click on Print. Verify that all the prints which were in the queue.
Case 4: Ensure correct behavior of application if a printer is uninstalled. Steps:1. Verify that printer is uninstalled from machine.2. Open the application and click on Print.3. Verify that the proper message appears for printer unavailability.
Case 5: Ensure correct behavior of Print functionality with the newly installed printer. Steps:1. Verify that printer is uninstalled from the machine. 2. Now, install the printer on the 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 (Refer iReuse.com paging)
Test Case 1:
1. Try to enter Qty we want more than Qty available (this should not happen).
2. Try to enter alphabets (this should not happen).
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 the same entered items.
4. Click again on page 2 and see if this remembers the same entered items.
5. Submit, check the email and match the 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 the same entered items. Then change some items.
5. Submit, check the email and match the result.
Expected critical errors: Sometimes 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 a long file name while functionality was working file with the small filename. Also, I received the server error when used *.JPG, but the application was working fine with extension .jpg.

4 thoughts on “Test cases and their examples

  1. It’s perfect time to make some plans for the future and it is time
    to be happy. I have read this post and if I could I desire to
    suggest you some interesting things or advice.

    Perhaps you could write next articles referring to this article.
    I wish to read more things about it!

  2. My partner and I absolutely love your blog and find
    the majority of your post’s to be just what I’m looking for.
    Do you offer guest writers to write content for you personally?
    I wouldn’t mind composing a post or elaborating on many of the subjects you
    write in relation to here. Again, awesome site!

  3. Excellent blog! Do you have any tips for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress
    or go for a paid option? There are so many options out there that I’m completely overwhelmed ..
    Any recommendations? Many thanks!

Comments are closed.