Slowing down Watir tests

J

jeffz_2002

I'm writing Watir tests for an application. My company isn't used to
automated testing, so I'm assuming that some people are going to want
to follow each test while they run, to be sure that the appropriate
thing is occurring. I'm thinking that I might want to have the test
run a statement and print that statement out to the console, and the
user could then hit a key to go to the next statement.

I'm guessing that there's a clever way in Ruby to handle this, but it's
a wee bit beyond my current Ruby ability. Any ideas?

Thanks,

Jeff
 
C

Charles Mills

I'm writing Watir tests for an application. My company isn't used to
automated testing, so I'm assuming that some people are going to want
to follow each test while they run, to be sure that the appropriate
thing is occurring. I'm thinking that I might want to have the test
run a statement and print that statement out to the console, and the
user could then hit a key to go to the next statement.

I'm guessing that there's a clever way in Ruby to handle this, but it's
a wee bit beyond my current Ruby ability. Any ideas?

Thanks,

Jeff

Run your tests from a computer on a dial-up connection :)

In all seriousness I am in a similar situation and have the same
question. Also is there an easy way to deal with java pop-up boxes?

-Charlie
 
C

Chris McMahon

puts "hit RETURN to click button 1"
line = gets
button1.click

puts "now RETURN for button2"
line = gets
button2.click

-Chris
 
J

jeffz_2002

This works, but it's a hassle. Essentially, if I have a script like
this:

button1.click
button2.click

I'd like the interpreter to do something like what you've said ...
e.g.,

puts "button1.click"
line = gets
button1.click

puts "button2.click"
line = gets
button2.click

set_slow_speed does slow down the typing, but I was hoping for
something /even slower/, so people could see each line, think about
what it's doing, and then run that line when they want.

Anyway, this is all just a nice-to-have. I might just write a simple
processor that takes a given test and writes out a new .rb file with
extra code between each line, like the above example.

Thanks,
jz
 
B

Bret Pettichord

You can control the speed of playback of Watir::IE

module Watir
class IE
def typingspeed(speed)
@typingspeed = speed
end
def sleeptime(pause)
@defaultSleepTime = pause
end
end
end

ie.typingspeed = 0.2
ie.sleeptime = 0.5

Bret
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top