On Mar 12, 2007, at 11:35 AM, Norman Palardy wrote:

>
> On Mar 12, 2007, at 3:28 AM, Aliacta wrote:
>
>>> Applescriptable application that you can use to drive a UI
>>> You can press buttons, etc.
>>> I thought about using it to write some tests for UI's but I'm not
>>> having much luck with RB apps so far so I figured I'd ask
>>
>> You have to check "enable access for assistive devices" in the
>> Universal Access control panel.
> I've done that
>
>> But I've never tried it with RB apps.
>
> I can't seem to get a button to "push"
> If I could we'd have a way of testing a UI automatically

I think it's certainly possible, if you want to go to the trouble of  
factoring your code to make it possible.  Here's a simple dumb  
example.  Suppose you have a window containing a Pushbutton and an  
EditField.   Pushing the button is supposed to set the EditField's  
text to "Foo". So add a method HandleAction(p as Pushbutton) to the  
window, and implement it to do the work.

Sub HandleAction( p as Pushbutton )
   EditField1.Text ="Foo"
End Sub

Now you can write test code to simulate a Pushbutton click.

Sub TestClickPushbutton()
   HandleAction Pushbutton1
End Sub


In the presence of more controls, it will of course become more  
complicated. Instead of adding methods to the window, you might want  
to use delegates that implement event handlers; then to simulate user  
actions, you simply call the delegate methods in test code.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to