views:

3266

answers:

9

I have a virtual machine (VMware) with Mercury Quick Test Professional 9.2 installed. I have a script to test an application, written in VB.NET using the Infragistics library.

If I access this virtual machine using my laptop (using Remote Desktop), everything works fine, the script completes without a problem. My laptop runs XP, with Windows Classic theme.

If I access this virtual machine using another machine (using Remote Desktop), the script starts fine, but stops halfway through, without no error message from QTP, nothing. This machine runs XP, with Windows Classic theme.

One difference between the two setups is the size of the screen, the laptop is 1920x1280, other machine 1280x1024.

The step where the script stops involves checking a checkbox within an UltraWinGrid. The checkbox itself is displayed, is on the screen in both cases.

Has anyone had this problem before, or have any idea why the behaviour is different between the two machines?

Thanks.

A: 

We have seen this sort of behavior with qtp, it seems like qtp stores pixel position in order to click buttons and check boxes. We wrote some VB code to check the resolution before launching the script and that seems to work ok. We also decided to buy to identical drivers for qtp to minimize this sort of problem.

+1  A: 

If you are not using Expert Mode, and / or are allowing QTP to do most of the work to create your repository objects, then yes it is referencing everything by pixels.

I create all of my repository objects by hand, viewing the source (in the case of automated web-application testing) and using the Object Spy for assistance where needed. I make a point to not have any positioning information as part of my object definition, for the very reason you are running in to.

For the parts of my web-app that interacted with Windows (opening a file to upload, etc.) the Object Spy was essential for the trial and error necessary to create a unique identifier for creating the repository object. But it can be done.

Ex1: File Browse Dialog
text = "Choose file"
nativeclass = #32770 (apparently some Windows VooDoo for a file open dialog?)

Ex2: Filename textbox in Browse dialog:
nativeclass = "Edit"
attached text "File &name:" (more Windows VooDoo? It woudn't work for me without the "&")

Ex3: Open Button in the dialog:
text = "&Open"
object class = "Button"

Good Luck!

JNeefer
A: 

QTP does not use screen coordinates except as a last resort, if the objects are identified as high level objects (SwfTable in this case) you should be OK, if however QTP doesn't recognise the object it falls back to WinObject and screen coordinates.

If you're using Infragistics then you should know that they extend QTP's support with their TestAdvantage product which will probably solve your issue.


Edit: @MatthieuF said:

In fact, we use the Infragistics plugin for QTP, and we still have the problem

Can you give me an example of a line that fails?

Motti
A: 

In fact, we use the Infragistics plugin for QTP, and we still have the problem.

MatthieuF
A: 

A few things:

You should be able to debug on the VM easily - just wait for it to stop, go into your object repository, and see if it can identify the object. If no then use object spy to figure out what properties are different between the OSes. If there is a difference then you can always set that property to a regular expression and have it check for both possibilities.

Assuming that isn't the issue we've run into problems using remote desktop with QTP if the Remote window is closed or minimized. For us, it was an issue where the clipboard can not be changed when an RDP window isn't visible, but there could be other surprises when using QTP that way.

tloach
A: 

When I say it stops, it doesn't offer a skip/retry/debug window, it just stops the script, as if it had finished the script. I did have problems when I minimize the remote desktop, so I stopped doing that :-).

MatthieuF
+1  A: 

Point of clarification: You mentioned that QTP stops with no error message. Does that also mean that the test results log file also has no error message? If the log has any information, that may be helpful in diagnosing the problem. Could you share the lines of code at the point where the script fails?

Also, remote desktop will resize the desktop on the remote machine. Although QTP scripts are not inherently coordinate based, individual statements can be coordinate-based relative to an object. The resolution could be an issue in that regard. For example, imagine you had a line like Button.Click(5, 150) recorded on a higher resolution machine. But if you attempted to play it back on a lower resolution machine, and the 150 is out of bounds of the object on the lower resolution, it could cause an issue.

Tom E
+4  A: 

OK. I've found the problem. In fact, the script was failing silently because that's what the person who wrote the script told it to do. It couldn't validate something which was off screen, so the script failed.

The problem was the QTP definition of 'off screen'. I have two screens attached to my laptop, the screen for the laptop itself (1920x1200) and another screen (1280x1024). I connect to the VM for QTP using remote desktop, and it uses the settings of the screen for the laptop. This means that when I launch my QTP script, and move it to the other screen, it doesn't fit, so the screen is no longer maximized, and the object is partially off screen, so can't be found.

The fix is simple: in the Remote Desktop, use the Display tab, and set the size of the screen to a size to 1280x1024, and QTP doesn't have any more problems.

Voilà.

MatthieuF
I guess visible is relative :) I'm RDPing from Linux, so I haven't run in to that particular issue, given that my RDP window can't be resized after I start it...
tloach
A: 

direct windows execute code