How can i slow down the execution of windows tester.

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

How can i slow down the execution of windows tester.

Postby karthik.intels12 » Mon Apr 26, 2010 4:52 am

Hello,
Is there any way to slow down the execution of windows tester. I know that we can slow the execution by setting delays in preferences. But i want some particular piece of code alone should execute slowly. Is there any way to achieve it.
Thanks and Regards,
Karthik.M.S
karthik.intels12
 
Posts: 35
Joined: Wed Mar 31, 2010 4:37 am

Re: How can i slow down the execution of windows tester.

Postby Phil Quitslund » Mon Apr 26, 2010 7:58 am

There is no API-approved way of slowing down playback selectively. That said, could you post a snippet of what you're trying to do? Maybe we can help cook up a work-around...

Thanks!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: How can i slow down the execution of windows tester.

Postby karthik.intels12 » Mon Apr 26, 2010 9:56 pm

Hello,

Ya I have Four buttons which is created using Image Hyperlink. it will enable and disable accordingly the changes made in table.

For example, If there is No item in table, Delete Hyperlink should disable and once we added any row, delete should be enabled.

So here i want to check for enablement and disablement of hyperlink. The way that hyperlink works is if we move mouse on it, it will change the state, or else it will retain in the existing state. So i have used mouse move on the buttons. Since mouse move is very fast it cannot identify the movements, so its state is not getting change.


Here i have attached file for your reference
Attachments
post.java
(2.4 KiB) Downloaded 11 times
Thanks and Regards,
Karthik.M.S
karthik.intels12
 
Posts: 35
Joined: Wed Mar 31, 2010 4:37 am

Re: How can i slow down the execution of windows tester.

Postby Phil Quitslund » Tue Apr 27, 2010 8:36 am

Thanks for the snippet. The good news is we can solve your issue without relying on playback delays (really a last resort anyway!) The approach is to use conditions rather than delays. A bit of background on conditions can be found here:

http://downloads.instantiations.com/WindowTesterDoc/integration/latest/docs/html/reference/conditions.html

But the idea is basically that a condition encapsulates a test of a property (essentially a predicate); paired with runtime logic that tests conditions in a managed way it is possible to author tests that clearly communicate your intentions and are robust in practice. In your case, the trick is to define a new condition type that looks something like this:

Code: Select all
   public class IsEnabledCondition implements ICondition {
      
      private final Hyperlink link;
      private final boolean enabled;
      
      public IsEnabled(Hyperlink link, boolean enabled){
         this.link = link;
         this.enabled = enabled;
      }
      
      public boolean test(){
         return isEnabled(link) == enabled;
      }
      
   }


And then replace invocations like this one:

Code: Select all
assertEquals(false, TestUtilsGUI.isHyperLinkEnabled(convertNRemoveHyperLinkIns));


With ones like this:

Code: Select all
ui.assertThat(new IsEnabledCondition(convertNRemoveHyperLinkIns, false));


Notice that having done this, the test will be more robust *and* in contrast with the delayed version will run as quickly as it can since the condition evaluations return immediately as opposed to simply waiting for a delay timeout.

Hope this helps!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: How can i slow down the execution of windows tester.

Postby karthik.intels12 » Wed Apr 28, 2010 2:18 am

Hello Phil,
Thanks For your reply.
Ya this type of condition check i tried and that condition check is working fine. But here i didn't get what i want actually. Here hyperlinks getting enable and disable according to the mousemove on that widget. I have attach the screenshot of that page how it looks.

Here If i click add, One row will add in first table. So After that add only all hyperlink should enable. Initially it will be disable condition. Here once i click ADD hyperlink, other Hyperlinks is not getting enable because Mouse move on that hyperlink is required to change the state of hyperlink. when i do manually, its working fine. But when i code it with MOUSEMOVE also and run it, Since mousemove is very fast hyperlink couldn identify that movement and still it is disable only. I could see that mouse movement on those hyperlink in editor.....

I didn't understand why that state of hyperlink is not changing. Because when i do it manually with my RCP, it is happening.
Attachments
table.png
table.png (7.8 KiB) Viewed 156 times
Thanks and Regards,
Karthik.M.S
karthik.intels12
 
Posts: 35
Joined: Wed Mar 31, 2010 4:37 am

Re: How can i slow down the execution of windows tester.

Postby Phil Quitslund » Wed Apr 28, 2010 8:30 am

My guess is that the state change is triggered by a hover event notification. It's possible that a hover event is not being generated by our mouseMove implementation. I've noticed in other places (notably drag events) that some OSes require a bit of a mouse wiggle to trigger certain events. To test this theory, let's try to add a little wiggle to the move like this:

Code: Select all
ui.mouseMove(new XYLocator(new NamedWidgetLocator("comp 3"), 1, 1));
ui.mouseMove(new XYLocator(new NamedWidgetLocator("comp 3"), 3, 3));
ui.mouseMove(new NamedWidgetLocator("comp 3"));

Could you try that and see if that works?
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: How can i slow down the execution of windows tester.

Postby karthik.intels12 » Fri Apr 30, 2010 4:08 am

Ya Thanks Phil. Its working now. Perfect solution.. :D :D :D :D :D
Thanks and Regards,
Karthik.M.S
karthik.intels12
 
Posts: 35
Joined: Wed Mar 31, 2010 4:37 am

Re: How can i slow down the execution of windows tester.

Postby Phil Quitslund » Fri Apr 30, 2010 8:00 am

Good deal. Glad that worked!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest