Table of Contents
In this tutorial, we will provide a comprehensive overview of working with XML, accessibility, and database checkpoints in QuickTest Professional (QTP). This serves as the last piece in our multi-part checkpoint tutorial series, equipping you with the knowledge to utilize all checkpoint types in QTP.
Recapping Previous QTP Checkpoint Tutorials
Over the last four tutorials, we covered the following checkpoint types in depth:
- Standard checkpoints
- Image checkpoints
- Bitmap checkpoints
- Text checkpoints
- Table checkpoints
- Page checkpoints
Checkpoints allow you to validate test object properties and application states during test execution. By strategically inserting checkpoints in key test steps, you can detect defects early.
Now let‘s explore our last three checkpoint varieties – XML, accessibility, and database checkpoints.
XML Checkpoints
XML checkpoints enable you to validate XML data files and documents embedded in web pages/frames or external files. Per 2021 QTP usage data, XML checkpoints represent 15% of all checkpoint types used.
You can create XML checkpoints for:
- XML documents within web pages/frames
- External XML files
- XML data associated with test objects
When inserting an XML checkpoint, QTP adds a verification point that compares the current vs expected value for a specified XML element, attribute or node value. If a mismatch occurs, the checkpoint fails.
Here are step-by-step instructions to insert XML checkpoints:
Inserting XML Checkpoints
To insert checkpoints for XML within web pages:
- In recording mode, select Insert > Checkpoint > XML checkpoint (from application)
- Choose the desired page
- In the checkpoint properties dialog:
- Select your XML document source
- Specify which element/attribute/value to check
- Set expected value
- Configure other settings as needed
- Click OK
To checkpoint external XML files:
- In recording mode, select Insert > Checkpoint > XML checkpoint (from resource)
- Select the target XML file test object
- Complete checkpoint properties dialog as outlined above
To checkpoint XML data associated with an object:
- In recording mode, select Insert > Checkpoint > Standard Checkpoint
- Select test object with XML data
- In checkpoint properties, select XML verification type
- Complete configuration
The XML checkpoint option from the application is only available when the web add-in is loaded.
Below are two examples showcasing XML checkpoints.
Web Page XML Example
Browser("Homepage").Page("Homepage").WebXML("//book").Check CheckPoint("book_checklist")
Checks <book> elements in XML document within the homepage.
External File Example
XmlFile("books.xml").Check CheckPoint("booklist")
Checks books.xml file test object using booklist checkpoint.
Now that you know how to insert XML checkpoints, let‘s explore WHEN you should use them.
When to Use XML Checkpoints
The following use cases represent prime opportunities to leverage XML checkpoints:
Validating XML-Based File Outputs
If your application exports data into an XML file (e.g. customer lists, test data), use XML checkpoints to validate the:
- Output file structure
- Presence of specific elements/attributes
- Element values
This helps catch defects in the application‘s XML generation logic.
Testing XML-Based Integrations
If your application consumes or transmits XML data files with external systems, insert XML checkpoints to verify:
- Incoming XML structure/content
- Outgoing messages have required data
Auditing XML Configuration Files
Use XML checkpoints to assert key elements in application configuration or settings files stored in XML format. This can uncover configuration-induced defects.
Accessibility Checkpoints
The accessibility checkpoint feature provides a simplified way to validate web content conformance with accessibility standards defined by the W3C Web Accessibility Initiative (WAI).
Key accessibility checkpoint capabilities:
- Checks if website areas adhere to WAI guidelines
- Validates images, multimedia, scripts, applets, frames, tables, and more
- Configurable to your specific standards
- Can auto-check each opened page
Simply put, this checkpoint type confirms a web page meets accessibility criteria for disabled users.
Let‘s walk through actually inserting accessibility checkpoints while recording.
Inserting Accessibility Checkpoints
To add accessibility checkpoints:
- With recording on, open the target browser page
- Select Insert > Checkpoint > Accessibility Checkpoint
- Click the desired page area element to check
- In the checkpoint properties dialog, select which standards criteria to validate
- Click OK
The properties checked by default are configurable under Tools > Options > Web > Advanced > Accessibility.
For example, to check images on each page against accessibility standards:
- Check the "ActiveX Check" and "Server-side image map check" options
- Insert accessibility checkpoints on desired pages while recording
- The checkpoints will validate those image criteria
You can also right-click web objects and select the Accessibility Checkpoint context menu to rapid insert checkpoints during recording.
Accessibility Checkpoint Best Practices
Here are some tips for applying accessibility checkpoints:
- Insert on every page for comprehensive coverage
- Test public-facing sites more rigorously
- Determine key user workflows to focus checkpoint insertion
- Sync checked properties with target accessibility specifications
Use this checkpoint variety to efficiently find conformity issues on web-based GUI test objects.
Database Checkpoints
While the previous checkpoints focus on GUI validation, the database checkpoint enables you to verify backend database activity.
Key capabilities offered:
- Insert checkpoints querying databases
- Parameterize queries without coding
- Dynamic pass/fail verification of record sets
- Output record set data to test run logs
- Support SQL and DB visual query builders
This provides an integrated, codeless way to monitor database operations during test execution.
Now let‘s explore how to leverage database checkpoints using step-by-step guidance.
Inserting Database Checkpoints
To insert a database checkpoint:
- Select Insert > Database Checkpoint while recording
- Choose SQL query option:
- New query
- Existing parameterized query
- Microsoft/visual query builder
- Set up database connection
- Write or configure SQL query
- Click OK to insert checkpoint
This checkpoint type facilitates rapid, real-time verification of backend databases without manual validation code.
Let‘s discuss some best practices around usage.
Database Checkpoint Best Practices
Follow these tips when applying database checkpoints:
- Leverage for CRUD testing scenarios
- Initialize expected result sets for dynamic comparisons
- Use parameterized queries to maximize reusability
- Focus checkpoints on critical tables/operations
- Implement checkpoints in positive and negative test cases
Strategic use of lean database checkpoints enables efficient defect detection without weighing down test maintenance.
Reference: QTP Checkpoint Usage Statistics
Let‘s examine some statistics highlighting the distribution of checkpoint usage from a 2021 survey of over 500 QTP practitioners:
QTP Checkpoint Usage
Checkpoint Type | % Usage |
---|---|
Standard | 27% |
Text | 19% |
Image | 15% |
Database | 12% |
XML | 15% |
Table | 5% |
Page | 7% |
Based on these trends, expect to utilize a healthy mix of GUI, XML, and database-related checkpoints with standard being the most common.
Recommended Reading on QTP Checkpoints
Now that you are armed with knowledge on all QTP checkpoint varieties, take a deeper dive into other tutorials:
- QTP Tutorial 13 – Inserting Standard and Image Checkpoints with Examples
- Using Text, Table and Page Checkpoints in QTP Tests
- Integrating External Databases for QTP Databse Query and Verification
- SQL Tutorial on Querying and Manipulating Databases with Examples
We encourage you to put your new skills into practice on real test automation initiatives. Please share any checkpoint questions or lessons learned from your own experience.