Recently I was working with one of our customers Keith Marshall on integrating QTP with dynaTrace. Below is an explanation of that process
Integration between the QuickTestProfessional (QTP) product and dynaTrace is quite simple to implement and provides visibility between the tests being executed and the application behavior of the underlying system. To implement this integration we will show a simple example.
QTP scripts are simply a collection of VBScript statements. As such, QTP scripts have full access to the Microsoft VBScript library, which includes the ability to define custom HTTP headers. By defining custom HTTP headers, we are able to define transaction names for each unit of work which are picked up by dynaTrace during the execution of the backend serverside (Java, .NET, ?) code which cooresponds to each unit of work, or in dynaTrace terminology, each Purepath.
After recording your test sequence in QTP, open the Expert View and you can see the VBScript code directly. You will find various calls to Open(URL,?,?) which is what defines the URL which is to be opened during execution. Each call to Open() is followed by a call to Send(). Between these two calls, we can insert calls to SetRequestHeader() and define the dynaTrace tag which you want to coorespond to the URL being opened. Let’s look at an example:
Notice the usage of the setRequestHeader call between the open() and the send(). This is where we define the ‘tag name’ which uniquely identifies this request to dynaTrace. Any NA= value can be used, as long as the first parameter is ‘dynaTrace’.
Therefore, in a sequence of page requests within my QTP script (a sequence of open() and send() calls), I can insert setRequestHeader() calls, each with a unique NA value. One example you could use is to specify “NA=Login” when exercising the user login step, and specify “NA=Search” when performing the product search step. In the example above, I defined “Choose your trip” as that was the part of the QTP script I was exercising.
There are a few other optional parameters that can be defined along with the NA= attribute. Details of this and the dynaTrace HTTP header are described on the dynaTrace Community Portal Integration with Web Load Testing and Monitoring Tools page.
Below is a screenshot of what the Tagged Web Request would look like from such an integration. Note that the results would show lots of different timer names as you would actually be setting different NA= values, one for each functional event being tested in the QTP script.
In conclusion, you can see that it is very easy to perform this integration and thus provide an easy way to better understand the connection between the QTP script activity, and the backend server activity.
Additional integration opportunities exist with QTP related to using test automation which is described in a separate forum post.
It is also possible to automate the process of starting/stopping a session recording from within the QTP script. This involves calling the dtcmd.cmd command and passing a few arguments. We’ll cover that in a future post real soon.
Thanks Keith for helping come up with this detail.