[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ajax woes

Patrick Spence

2/5/2007 2:57:00 PM

The C# web app we are automating for QA testing has been recently
converted to Ajax. Because of it's asynchronous nature, this has broken
all our test scripts. In order to get them to work, we resorted to
inserting a "sleep()" statement at the beginning of test method in the
test suite, certainly not an ideal solution. So, in the meantime, we're
stuck with this nonsense:

def test_0001_username()
sleep(2)
@@ie.text_field(:id,'ctl00_lgnLogin_UserName').set('TEST-5038')
end

def test_0002_password()
sleep(2)
@@ie.text_field(:id,'ctl00_lgnLogin_Password').set('passw0rd')
end

def test_0003_loginButton()
sleep(2)
@@ie.button(:id,'ctl00_lgnLogin_LoginButton').click
end

Has anyone else run into this and what was your solution? Thanks!

--
Posted via http://www.ruby-....

16 Answers

Patrick Spence

2/5/2007 5:21:00 PM

0

Jason Roelofs wrote:
> There is a method on @@ie (i'm assuming Watir usage here) called
> something
> like #wait_for_response that will block until said execution is done.
>
> Jason

I found a #wait method, no #wait_for_response. I tried that and it
didn't help.

On one of the forms, one page of a 13-page health risk assessment,
there's a radiobutton control associated with the question "I know my
blood pressure". If the user clicks "Yes", then 2-more textboxes are
displayed where they enter the systolic and diastolic readings. Without
the "sleep()" statements, the textboxes are skippped, after logging an
error stating that the 2-textboxes couldn't be found. The health risk
assessment was taking about 2.5 mins to complete. With all the sleep()
statements it's now taking about twice that long, as one would expect.

--
Posted via http://www.ruby-....

(Alex Furman)

2/5/2007 5:53:00 PM

0

On Feb 5, 12:21 pm, Patrick Spence <patr...@pkspence.com> wrote:
> Jason Roelofs wrote:
> > There is a method on @@ie (i'm assumingWatirusage here) called
> > something
> > like #wait_for_response that will block until said execution is done.
>
> > Jason
>
> I found a #wait method, no #wait_for_response. I tried that and it
> didn't help.
>
> On one of the forms, one page of a 13-page health risk assessment,
> there's a radiobutton control associated with the question "I know my
> blood pressure". If the user clicks "Yes", then 2-more textboxes are
> displayed where they enter the systolic and diastolic readings. Without
> the "sleep()" statements, the textboxes are skippped, after logging an
> error stating that the 2-textboxes couldn't be found. The health risk
> assessment was taking about 2.5 mins to complete. With all the sleep()
> statements it's now taking about twice that long, as one would expect.
>
> --
> Posted viahttp://www.ruby-....

I don't think it is possible with current WATIR implementation.
You can also try SWExplorerAutomation SWEA (http:\\webiussoft.com).
SWEA supports AJAX and eleminates "sleep" statements by monitoring
network traffic and DOM changes - it improves the test automation code
reliability and performance. SWEA is .Net framework, but can be used
from Ruby using RubyCLR.

Patrick Spence

2/9/2007 2:03:00 PM

0

alex_f_il@hotmail.com wrote:
> I don't think it is possible with current WATIR implementation.
> You can also try SWExplorerAutomation SWEA (http:\\webiussoft.com).
> SWEA supports AJAX and eleminates "sleep" statements by monitoring
> network traffic and DOM changes - it improves the test automation code
> reliability and performance. SWEA is .Net framework, but can be used
> from Ruby using RubyCLR.

Thanks for the link, but I was hoping for a Ruby solution. I was
thinking that it's possible to override the
Watir::Element.assert_exists() method. Perhaps go into a loop, on each
iteration of the loop checking @ieController.status for "done" and/or
@ieController.document.readyState == 4. The loop would one run a
specific number of times before exiting and letting Watir throw the
error.

Using the scenario I previously mentioned regarding the blood pressure
radio button and textbox controls... I've noticed that when the "I know
my blood pressure" radio button is clicked, the IE status bar briefly
changes to "Please wait..." while Ajax is doing it's thing. By "doing
it's thing" I mean updating the page to display 2-textbox controls where
the user inputs the systolic and diastolic reading. After the textboxes
are displayed, the status changes back to "Done".

Ideas or hints anyone? Thanks!


--
Posted via http://www.ruby-....

bpettichord

2/11/2007 9:56:00 PM

0

On Feb 5, 8:56 am, Patrick Spence <patr...@pkspence.com> wrote:
> def test_0001_username()
> sleep(2)
> @@ie.text_field(:id,'ctl00_lgnLogin_UserName').set('TEST-5038')
> end

Actually, the latest version (1.5) of Watir *does* support Ajax. Thus:

def test_0001_username()
Watir::wait_until {@@ie.text_field(:id,
'ct100_lgnLogin_UserName').exists?}
@@ie.text_field(:id,'ctl00_lgnLogin_UserName').set('TEST-5038')
end

Bret

bpettichord

2/11/2007 9:57:00 PM

0

On Feb 5, 11:53 am, "alex_f...@hotmail.com" <alex_f...@hotmail.com>
wrote:
> I don't think it is possible with currentWATIRimplementation.

Why do you say this?

Patrick Spence

2/12/2007 12:50:00 PM

0

Bret Pettichord wrote:
> On Feb 5, 8:56 am, Patrick Spence <patr...@pkspence.com> wrote:
>> def test_0001_username()
>> sleep(2)
>> @@ie.text_field(:id,'ctl00_lgnLogin_UserName').set('TEST-5038')
>> end
>
> Actually, the latest version (1.5) of Watir *does* support Ajax. Thus:
>
> def test_0001_username()
> Watir::wait_until {@@ie.text_field(:id,
> 'ct100_lgnLogin_UserName').exists?}
> @@ie.text_field(:id,'ctl00_lgnLogin_UserName').set('TEST-5038')
> end
>
> Bret

Thanks Bret! I'll give this a go, since the waiting for a status of
"Done" approach doesn't appear to be working.

--
Posted via http://www.ruby-....

Patrick Spence

2/12/2007 1:10:00 PM

0

Patrick Spence wrote:
>> Bret Pettichord wrote:
>> Actually, the latest version (1.5) of Watir *does* support Ajax. Thus:
> Thanks Bret! I'll give this a go, since the waiting for a status of
> "Done" approach doesn't appear to be working.
Actually, I'll need to download v1.5. The most current version on
rubyforge.org is 1.4.1. Where can 1.5 be found?

Thanks!


--
Posted via http://www.ruby-....

Patrick Spence

2/12/2007 1:19:00 PM

0

Patrick Spence wrote:
> Actually, I'll need to download v1.5. The most current version on
> rubyforge.org is 1.4.1. Where can 1.5 be found?
>
> Thanks!
I found v1.5.1 at http://www.io.com/~w..., along with suggestion
that those running v1.5 should update to 1.5.1.

--
Posted via http://www.ruby-....

Patrick Spence

2/13/2007 7:03:00 PM

0

Bret Pettichord wrote:
> On 2/12/07, Patrick Spence <patrick@pkspence.com> wrote:
>>
>> Actually, I'll need to download v1.5. The most current version on
>> rubyforge.org is 1.4.1. Where can 1.5 be found?
>
>
> http://wiki.openqa.org/display/WTR/Developm...
>
> But there seems to be a problem with the gem attachments at the
> moment...

I don't know if that has anything to do with the problems I'm still
having. The #wait_until technique isn't working either. The decision of
the development folks to convert the app to Ajax was made w/o consulting
the QA department as to the possible ramifications. That, on top of the
other problem has forced us to look at other alternatives to Ruby/Watir.
It's a bloody shame too as we've made a sizable investment in the
development of the core code and classes in Ruby.

--
Posted via http://www.ruby-....

Patrick Spence

2/13/2007 11:27:00 PM

0

Bret Pettichord wrote:
> Don't give up too soon. We have plenty of Watir users who are using
> Watir
> 1.5 to test Ajax applications.
>
> Bret

Any further input or advice would be greatly appreciated! I love the
Ruby/Watir combination. BTW, I don't what you've done with the latest
build of Watir; v1.5.1, but it's so fast it's almost frightening! Up
until a couple of days ago I was using v1.4 and running a script w/in
the Komodo IDE was painfully slow. With the latest build, even while
running w/in Komodo, the scripts run as fast as the previous build did
as a standalone script. Outstanding work!


--
Posted via http://www.ruby-....