QTP Tutorial #16 – Steps to Insert XML, Accessibility, and Database Checkpoints

Today we will continue with remaining QTP checkpoints i.e XML, Accessibility, and Database Checkpoints. This is the last tutorial on QTP checkpoints. We have covered details of all QTP checkpoints in last 4 tutorials.

XML checkpoint:

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.

  1. You can perform checkpoints on XML documents contained in Web pages or frames, on XML files, and on test objects that support XML.
  2. An XML checkpoint is a verification point that compares a current value for a specified XML element, attribute and/or value with its expected value.
  3.  When you insert a checkpoint, QuickTest adds a checkpoint step in the Keyword View and adds a Check CheckPoint statement in the Expert View.
  4. When you run the test, QuickTest compares the expected results of the checkpoint to the current results. If the results do not match, the checkpoint fails.

You can create three types of XML checkpoints:

  1. XML Web Page/Frame Checkpoint. Checks an XML document within a Web page or frame.
  2. XML File Checkpoint. Checks a specified XML file.
  3. XML Test Object Checkpoint. Checks the XML data for an object or operation.

The method to insert this checkpoint is almost similar to the other ones.

Step #1) While recording, select “Insert->Checkpoint->XML checkpoint( from application) option

Step #2) Select the page where you want to insert the checkpoint

Step #3) The following screen comes up:

XML Checkpoints

Step #4) Set the values as desired in this screen and click OK

Step #5)

 Browser("Browser").Page("Page").WebXML("http://www.w3schools.com/xml/c").Check CheckPoint("http://www.w3schools.com/xml/cd_catalog.xml") 

– This statement gets inserted

Alternately, if you need to insert an XML checkpoint on a file in your machine, you can choose the option:

Insert->Checkpoint-> XML checkpoint(from resource)” and select the XML file test object.

The steps that follow are similar to the above ones.

The option “XML checkpoint(from application)” is available only when the web add in available and loaded for a certain test.

Accessibility checkpoint

This checkpoint is supported only when the web add-in is available and loaded. It checks or recognizes if the areas on a website conform to WWW consortium Web accessibility guidelines.

It can be added while recording or editing through active screen.

The properties that we can check based on the accessibility checkpoint are:

  1. Active X check
  2. Alt property check
  3. Applet check
  4. Frame titles check
  5. Multimedia check
  6. Server side Image check
  7. Tables check

The tester has an option to check for one or more of the properties in the above list.

The settings can be changed from the menu option “Tools->Options->Web->Advanced- Accessibility options. You can check or uncheck the options as required.

To insert, simply start recording a test. In my case, I am opening a Gmail.com page and I am doing this by setting the URL properties in the record and run setting instead of programmatically. As soon as the Gmail.com page has opened I chose the menu option “Insert->Checkpoint->Accessibility checkpoint” and click on the page. The following screen opens up:

Accessibility checkpoint

Choose the page object and click OK. The properties that can be checked will be displayed for the user to choose one or multiple options. Also, the message at the end of the property selection explains the basis on which the default selection is made.

Accessibility checkpoint

Let us take a look at what options are chosen at “Web->Advanced” pane of the Options dialog box.

Accessibility checkpoint

This explains why only the “Alt Property check” is selected by default in the “Accessibility Checkpoint Properties dialog box”. If I had a different set of checks ON in the Web->Advanced pane of the Options dialog box, the same would reflect for any of the subsequent Accessibility checkpoints that you might include in your test.

Click OK on the Accessibility Checkpoint Properties dialog box. As in the case of the other checkpoints, the following statement gets added to your test.

 Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Check CheckPoint("Gmail: Email from Google") 

You can modify it just the way you would do with any other checkpoints from the OR and the test results will show a pass if the check has passed or failed if it did not.

You can choose to add a check by default to every web page you access by setting the option ON as shown in the below screenshot:

Accessibility checkpoint

Database checkpoint:

The way this checkpoint works is, you first define a query on your database and create a DB checkpoint that checks the results of the query and thus detects defects.

Two ways to define a query:

1) Microsoft query – You can install Microsoft Query from the custom installation of Microsoft Office.

2) Manually write a SQL query.

I just created a Microsoft Access table named Contacts and added a row with my information. This is how the table looks: (click to enlarge image)

Database Checkpoint

------------

I want to place a database checkpoint on this. The following are the steps:

Step #1) Select “Insert->Database Checkpoint” from the menu.

Step #2) In the following screen, select “Specify SQL Query manually” option and select Ok.

Database Checkpoint

Step #3) You will need to create a connection string. So click “Create” in the screen

Step #4) If you already have a DSN created. Choose it from the below screen

Database Checkpoint

Step #5) If you do not have a created DSN, we will create one. Click on the “New” button and choose your database type from the list available. I am going to choose “Microsoft Access Driver (.mdb, .accdb)” from the list.

Database Checkpoint

Step #6) Click Next and Browse for a location where you would want this DSN to be saved. I chose desktop and click Ok. In the next screen, click Finish.

Step #7) In the below screen, you can choose to select the data source, i.e the database on which you want to run the query. Click Select and browse for your database.

Database Checkpoint

Step #8) Choose your DB and click OK.  The DSN that you have just created will appear in the list. Select it from the below screen, and click OK.

Database Checkpoint

Step #9) You connection string is now created. All you need to do is put in the SQL query. For simplicity’s sake I am just going to do a “Select * from Contacts” and click Finish.

Database Checkpoint

Step #10) The results of your query run will be displayed in the “Database Checkpoint Properties” dialog box as follows. You can choose to check for just one columnXrow combination or multiple ones, as you would like in the below screen. All the other options are also self explanatory. You could also parameterize the expected results for more complicated scenarios.

Database Checkpoint

Step #11) The settings tab can be used to set the value match criteria

Database Checkpoint

Step #12) The Cell identification tab can be used to specify the way in which you would want QTP to identify rows and columns.

Database Checkpoint

Step #13) Once the properties are set and the checkpoint is created, the following statement gets added to your test.

 DbTable("DbTable").Check CheckPoint("DbTable") 

Step #14) The test results will show any deviations in the expected and actual results when the test runs.

This concludes QTP checkpoints. Please post your questions and comments.

Don’t miss the upcoming important tutorials on Automation Frameworks. In next couple of tutorials we will discuss about different types of Test Automation Frameworks with examples. By that time go through all the tutorials published till now.



Get FREE eBook + Blog Updates By Email!

Subscribe to get software testing awesome articles and free resources. Enter your email address and click 'SIGN UP NOW' button.


9 comments ↓

#1 venu on 05.06.13 at 6:24 am

If you provide us a complete video in a precise way for all these checkpoint than it will be an added advantage for us..

#2 Smeet on 05.06.13 at 7:45 am

database checkpoint steps are awesome. very helpful to understand the process of inserting checkpoints. thanks

#3 Hitesh on 05.18.13 at 1:20 pm

Nice article about checkpoints

#4 Sandeep on 06.25.13 at 6:51 am

An XML checkpoint is a test operation that verifies values of an XML document by comparing them with baseline values stored in your project. This may be necessary if the application under test exports data, for example, a customer list, into an XML file and you need to verify that the application generates the file correctly.

#5 mayank on 07.18.13 at 10:36 am

its nice tutorial about database checkpoint,easy to understand,thanks alot…..

#6 teena on 10.12.13 at 1:58 pm

i tried the database checkpoint example you mentioned her, but was getting an error while creating the DSN. It was asking for login credentials of the ODBC connection and says “unrecognized database format”. i tried creating a .accdb file using Microsoft access. But while selecting the driver in the database query wizrd, there was no driver specifying the extension .accdb, so i tried by selecting the .mdb driver.

can you please let me know how to overcome this problem.

#7 teena on 10.16.13 at 1:56 pm

I have tried put a Accessability Checkpoint (After opening IE browser for Yahoo home page). But I am geting an error which says “The object you selected does not support this operation”. This is happening even to XML checkpoint also. I have tried to click on different areas of the application but the result is same.t.
Can you please let me know where am doing wrong.Your help is appreciated.

Thanks

#8 Cynthya on 01.10.14 at 6:01 pm

Very Good Article on Checkpoints

#9 asreddy on 02.19.14 at 3:34 am

Hi all, please help me – I am working on UFT 11.53. I noticed that UFT is unable to create XML check point if the XML file has the symbol “&” eg: & abc guide . We get a popup saying like “file is not in proper format”. When we remove that ampersand “&” then it creates xml checkpoint successfully.

Please any suggestion?

thanks in advance
asreddy

Leave a Comment