July 7, 2008

QTP Quick Reference Card



As a WinRunner user, I've got very used to the concept of automated testing. Changing to QTP was not much of a problem except for the language notation. For example, the thing I always do wrong:




Select Case anyVariable
    Case 1,2
        ...
    Case Default ... ***CRASH***

And you'll only discover it at runtime, because Default is displayed in blue as it is used to set the default property for a class. ('Default' is the 'Case Else' in C/C++ or TSL).

For all advanced users having trouble with VBScript notation on the expert view, I want to share my QTP Quick Reference Card (also called Cheat Sheet). It displays all general functions you'll want to use in QTP.

The PNG version:



Or the smaller and more portable PDF version:



If you have any comments or additions on this document, please leave a message in the comments.

July 1, 2008

Get the text from a tooltip with WinRunner

Getting the text form a standard tooltip in an HTML document with WinRunner took me some time to figure out. Actually it is one small statement that will do the trick, but finding out what statement kept me searching for a while.

win_get_info("{class: window, MSW_class:\"tooltips_class32\",displayed: 1}","text",text);

This will do it. Really.

And to wrap it into a function:

 
public function get_tooltip(object, out text)
{
        auto hwnd, rc;
       
        # First set the cursor position to the left corner of the screen. When you don't do this,
        # a formerly captured tooltip can be hovering over the object, making it impossible
        # for WinRunner to locate it.
        rc = move_locator_abs(1, 1);
       
        # Move the cursor to the object containing the tooltip 
        web_cursor_to_obj(object, 1, 1);
 
        # Move the cursor back and forth to trigger the tooltip to pop up
        move_locator_rel(0,1);
        move_locator_rel(0,-1);
 
        # Wait for the tooltip. This is time consuming, something to keep in mind when
        # you want to use this function
        wait(2);
       
        # Check on visibility of the tooltip window, otherwise a standard tooltip does not exist for this object               
        if((rc = win_exists("{class: window, MSW_class: \"tooltips_class32\",displayed: 1}")) == E_OK)
               
                # Capture the text
                return win_get_info("{class: window, MSW_class: \"tooltips_class32\",displayed: 1}","text",text);
       
        return rc;
}
 

Keep in mind, this only works with standard tooltips, recognizable on the title='[text]' attribute in the HTML tag (not always visible when CSS is used). When the tooltip is a customized tooltip created by some JavaScript, most probably it is created as a frame object and you'll have to capture the text of that frame object in stead.

TestNet Voorjaars Event

Yesterday was the day of the TestNet Voorjaars Event. TestNet is the national Dutch organization for testers. There were some great presentations and off course the warm bath experience of seeing lots of old collegues. That is one advantage of being Dutch: The test community is not very large in numbers. TestNet has around 1200 members, while the test community is as large of 6000 professional testers.

The theme was TestTooling, so I fitted well. Actually, I was invited to do a presentation, which I did with Marc Koper, a collegue of mine.

If you are interested in the presentations (some real good ones included), you can find them at the TestNet Library Page. However, most of them are in Dutch.
If you are especially interested in our presentation, it is called "A tool with a fool is only a tool". It is an introduction in how you can set op test automation (Performance and Test execution) in a test organisation with lots of tips and tricks. Well, for the best tips and tricks, you should have been there, but later this month, I will put some of them on my blog.

Update: The abstract of our presentation