Reading:  

Quick Test Professional - The starters Guide


Working with XML in QTP

Extensible Markup Language (XML) is a text-based format that allows for the structuring of electronic documents and is not limited to a set of labels.

  • XML was designed to describe data, not to display data.
  • XML tags are not predefined. You must define your own tags.
  • XML is designed to be self-descriptive.

Sample XML and key elements are shown below:

XML Analogy

Image source: utexas.edu

Let's now check how we can access XML 

1. Creating an object for xmlDOM

set xmldom = Createobject("MSXML.DOMDocument")
xmldom.async = "False"

2. Loading a file using xml DOM

Xmldom.Load (FileName)

 

3. To Find number of parent nodes in a xml

Intlen = Xmldom.childnodes.length 

 4.To find names of parent nodes

 For i=0 to intlen-1
 strParNodeName = xmldom.childnodes(i).Name
 Next 

5. How to search a node with tagName

Set nodelist = xmldom.getElementsByTagName(strTagName)

Example

Access ML Example QTP

 

How to compare XMLs

We can compare two given xml's as shown in the code snippet below

Comparing XML QTP

 

 

Description

In this tutorial, we will get to know Quick test professional. At the time of writting QTP is at version 12.2. This tutorial is subdivided into multiple parts as shown below

  • What is QTP
  • Automating tests
  • Environment
  • Recording and Playback
  • Object Repository
  • Actions
  • Data Table
  • Checkpoints in QTP
  • Synchronization
  • Smart Identification
  • Debugging and Error handling
  • Recovery Scenarios
  • Environment Variables
  • Library Files
  • Test Results
  • GUI Objects
  • Virtual Objects
  • Accessing Databases
  • Working with XML
  • Descriptive Programming
  • Automation Object Model
  • A work on Frameworks

Leave your feedback for us, Feedback help us improve our tutorials.

 



Prerequisites

Some knowledge on Windows OS and VB Script is recommended

Audience

Students who wish to learn QTP

Learning Objectives

Learn QTP

Author: Subject Coach
Added on: 16th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!