While using Rational Robot to perform testing on a GUI for a class, I encountered some trouble when using the region capture form of validation. In order to better understand the problem, I created a simple GUI application that simply draws some shapes onto a window.
I then used the region capture tool to try to validate the drawing of a shape. After following the instructions, the tool seemed to have correctly captured a baseline to be used for validation of a rectangle. The Hide During Operation option was selected when capturing the region.
When running the script, however, the validation of this region failed on several attempts. The actual image that was compared to the baseline was different each time and on one attempt, the actual image was of the Region Capture Tool window that was used to capture the baseline.
I am inexperienced with Rational Robot and have been unable to determine what I should do to avoid this problem and any help on the matter would be appreciated.
The coordinates for Region Capture are screen relative (I think), so your window need to be exaclty at the same place at playback for it to work (so it's not very robust)
Try to first use SQAGetProperties on your window object to get the top and left properties, which you would then feed into the coordinates of the Region VP command.
For real fine tuning, you might even want to accomodate for the window's border width and other such properties.
Having said this, I have no idea how the Region Capture Tool could be on screen when you were playing back your script - strange :-/
(I am suprised that it captured your
The brief instructions for marking out the region you want in the region capture tool do say that you can capture anything on the desktop.
This suggests that the coordinates of the area you outline will be relative to the desktop, *not* relative to (as you might've expected) the top left corner of the window you thought you were addressing. You could check this out by trying some test-captures and keeping an eye on the coordinates you get.
So if the window containing your target area isn't in *exactly* the same place each time you run the test, the region capture won't match. An application with a window that doesn't take up the whole screen often seems to be displayed as if the window was being 'cascaded' if you start/close it several times (so the window tends to move down and to the right, about one title-bar-height at a time) so it can be hard to get your app into a 'known state' before the test.
A simple way round this might be to maximise the application window before doing the capture, that way it's always in the same place relative to the screen. Although some applications won't let you. This still won't allow the test to be portable - anyone running a different screen resolution to the machine the test was captured on will have trouble.
Bev's suggestion about calculating where to make the capture based on reading the window properties is definitely worth a try too.
Overall the region capture stuff isn't very robust (so it can take a lot of work to get it so it doesn't report lots of false alarms) and so I don't think most people find it all that useful.
I assume you are not trying to capture rectangles and circles on a screen, if you provide some specifics on what you are trying to capture, there may be a better solution than a screen image VP, such as SQAGetChildren or GetProperties... from which you could verify results on any property provided by the object you are trying to validate.
Automation Team Lead
Rental Quality Assurance