Wednesday, June 21, 2006
I mentioned WATIR a while back and I have been using it almost every day for the last month or so. The more I use it the more I like it. WATIR is built around Ruby as I mentioned earlier. So I've been looking into Ruby more and more. I have to say I really like it and am starting to use it for some repeative tasks. For example I have a WATIR test that logs into the applications, hits some links etc. It takes about 40 to 60 seconds to run. Well I decided that I really wanted to have a way to run it multiple times in a row. Well, I decided to write a quick Ruby script to take care of this for me. It took about two minutes to look up the system function, which works almost exactly as it does in PERL, another 5 minutes to code and debug and I was done

i = 0
done = ARGV[0]
testScript = ARGV[1]
 if(done == nil) or (testScript == nil)
 print "usage: ruby runmore.rb N ScriptName\n\r"
 print "N equals number of times test should run\n\r"
 print "ScriptName equals the ruby/watir script you want to run"
 else
    while i < done.to_i do
    system("ruby #{testScript}")
    i = i + 1
    end
 end

I'm really beginning to enjoy Ruby it's as readable as VB and as writable as PERL. Not bad for a interpeted language that doesn't use semicolons :-D Happy Coding

P.S. yes, I wrote a script to run another script...
6/21/2006 3:24:09 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):