Total Pageviews

Friday 27 January 2012

RK QTP Classes4


Checkpoints


QTP – Introduction to Checkpoints

Every test case will be having an “Expected Result” and during the execution, this needs to be compared with the “Actual Result” to verify whether the application under test is working properly as expected. QuickTest Professional provides an excellent feature called “Checkpoints” to accomplish this.
As the meaning of the word “checkpoint”, it compares the run time value for a specified property of an object to the existing value for that property.
There are eight different checkpoints available in QTP:
1.      Standard checkpoint
2.      Text checkpoint
3.      Text Area checkpoint
4.      Bitmap checkpoint
5.      Database checkpoint
6.      Accessibility checkpoint
7.      XML checkpoint (From an application)
8.      XML checkpoint (From a source)
To access the checkpoints in QuickTest:
Click Insert –> Checkpoint –> click on the desired checkpoint
Below figure shows the same.
This type of checkpoint is used to verify the property value of an object during runtime. We will try to record a test, insert a checkpoint, and verify the expected result.
Test Scenario:
Record the below test steps on Flight sample application.
1.      Login with appropriate credentials
2.      Insert a new order
3.      Verify the new order inserted (Insert Checkpoint)
Once the steps 1 & 2 are done, then insert the checkpoint:
1.      Click Insert—> Checkpoint—> Standard Checkpoint
2.      Click on the Edit box containing label “Insert Done..” (ActiveX Threed Panel Control)
3.      Some properties are selected by default (enabled, height, width, x, y)
4.      Uncheck these check boxes
5.      Select “text” property
6.      Click OK
Below is the code generated after the record:
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "admin"
Dialog("Login").WinEdit("Password:").SetSecure "4e9197d45a68ae7082b90807ff0c70a4ad5011f7"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "120312"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "Joseph"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").ActiveX("Threed Panel Control").Check CheckPoint("Threed Panel Control")
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
Execute the recorded test and open the test result.  Result contains the checkpoint status. Go through the below figure.
Since the property “text” is selected while inserting the checkpoint, only that value is compared with the run time value and the status is set as “Passed”.


Points to remember

Checkpoint is a confirmation or verification point in which the value of some property which is expected at a particular step is compared with the actual value which is displayed in the application. Based on the expected values Checkpoints are classified as follows

·         Page Checkpoint : A Standard Checkpoint created for a web page can be called a Page Checkpoint.  It is used to check total number of links & images on a web page. Page Checkpoints can be used to check Load Time i.e. time taken to load a web page.
·         Bitmap Checkpoint helps a user in checking the bitmap of an image or a full web page. It does a pixel by pixel comparison between actual and expected images.
·         Image Checkpoint enable you to check properties like source file location of a web image. Unlike , Bitmap Checkpoint  you can not check pixels(bitmaps) using image checkpoint.
·         Text Checkpoint is Used to check expected text in a web-page or application. This text could be from a specific region of the application or a small portion of text displayed
·         Accessibility Checkpoints verifies compliance with World Wide Web Consortium (W3C)  instructions and guidelines for Web-based technology and information systems. These Guidelines make it easy for disabled to access the web.
·         Database Checkpoints create  a query  during record time and database values are stored as expected values. Same query is executed during run time and actual & expected values are compared.
·         In Table Checkpoint , you dynamically can check the contents of cells of a table (grid) appearing in your environment. You can also check various table properties like row height , cell width and so on. Table Checkpoint is similar to Database Checkpoint
·         Using XML Checkpoints you can verify XML Data ,XML Schema,   XML Data




After we add a checkpoint, QuickTest adds a checkpoint to the current row in the Keyword View and adds a Check CheckPoint statement in the Expert View.

By default, the checkpoint name receives the name of the test object on which the checkpoint is being performed. We can change the name of the checkpoint if
needed.

Types of Checkpoints:
  1. Standard checkpoint
  2. Image checkpoints






  1. Bitmap Checkpoint






  1. Table checkpoints






  1. Accessibility Checkpoint






  1. Text Checkpoint






  1. Page Checkpoint






  1. Database Checkpoint






  1. XML checkpoints

Standard checkpoints
allow checking the object property values in the Web site or application under test. Standard checkpoints evaluate (compare) the expected values of object properties captured during recording to the object's current values during a run session. For
example we can check that a radio button is activated after it is selected.Standard checkpoints are supported for all add-in environments.

Standard checkpoints can be used to perform checks on

Images,
Tables,
Web page properties, and
Other objects within your application or Web site.

Standard checkpoints can be created for all supported testing environments (as long as the appropriate add-in(s) are loaded).

Image checkpoints
allow you to check the properties of an image in the application or Web page. For example, you can check that a selected image's source file is correct or not. An image checkpoint can also be created by inserting a standard checkpoint on an image object. Image checkpoints are supported for the Web add-in environment

With Bitmap Checkpoint we can check an area of a Web page or application as a bitmap. While creating a test, we have to specify the area to check by selecting an object. An entire object or any area within an object can be checked. Bitmap checkpoints are supported for all add-in environments

By adding table checkpoints to the test, we can check the content of tables displayed in the application. For example, we can check that a specified value is displayed in a certain cell. Certain environments also support checking the properties of the table object. For example, a check that a table has the expected number of rows and columns. A table checkpoint can also be created by inserting a standard checkpoint on a table object.

Accessibility Checkpoint
recognizes areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. For example, check if the images on a Web page include ALT properties, required by the W3C Web Content Accessibility Guidelines.Accessibility checkpoints are supported for the Web add-in environment

QuickTest can check that a text string is displayed in the appropriate place in an application or on a Web page with Text Checkpoint. Text checkpoints are supported for the Web add-in environment, plus some Web-based add-in environments

Page Checkpoint
checks the features of a Web page. For example, you can check how long a Web page takes to load or whether a Web page contains broken links. A page checkpoint can also be created by inserting a standard checkpoint on page object. Page checkpoints are supported for the Web add-in environment

The contents of a database accessed by your application can be checked byDatabase Checkpoint. Database checkpoints are supported for all add-in environments

By adding XML checkpoints to your test, you can check the contents of individual XML data files or documents that are part of your Web application. TheXML Checkpoint option is supported for all add-in environments.





Also See:


Example of QTP Standard Checkpoint
Example of QTP Existing Checkpoint
Example of QTP Page Checkpoint
Example of QTP Database Checkpoint
Example of QTP Bitmap Checkpoint
Example of QTP Image Checkpoint
Example of QTP Text Checkpoint
Example of QTP Table Checkpoint
Checkpoint Return Values


No comments:

Post a Comment