From D to Q to C with plenty of T

2007-Feb-22 - Everyday Ruby

Posted in Testing
A few months ago I had a play with Ruby and Watir and it seemed like it might be something to explore later on when I had more time

Of course I never had time but I did order Everyday Scripting in Ruby and started working my way through it. The book made the point that test scripts are not just for automating test execution but can be useful in many other ways.  The book starts off with simple examples for you to work through and builds up as you go through the book.

The day after reading the first couple of chapters I was able to put it to use - I was testing a program and a dialog didnt seem to be displaying all the characters that it should have been doing and I wanted to know how many it was displaying
So cut and paste the characters into a text file and save it
Start a command prompt window and start the Ruby interpreter

myarr = File.open("chars.txt").readline
mystr = myarr[0]
puts mystr.length

and there was my answer, 255 characters
Quite probably there is a more efficient Ruby way of doing it and most probably a million other ways of doing the same thing
But it was simple and got the job done

A few days later I realised I was often running the same 2 SQL scripts to clean up items from the DB that I was working with
So write the queries in Ruby, have a command prompt open and they can be run with a couple of clicks

Then it was back to Watir and Ruby
Open the test DB in Ruby and read all the order ID's from the DB
Loop round and load up the order page with the order ID
Repeat all night

Open the test DB in Ruby and read all the customer ID's from the DB
Loop round and load up the customer page with the customer ID
Repeat all night

simple but powerful
and I'm still only on Chapter 6

3 CommentsPost A Comment!Permanent Link

<- Last Page • Next Page ->

About Me

A developer breaking into the QA world - now broken into it and entering the world of test consultancy

Friends

neillmccarthy
testmanager
studley
csbdeady
ovidiu
strazzerj
jpweston
metalbaby
thepthial
EklecticTester
michaeljf
PeteNairn
jimtest
spikyone

Syndication

RSS Site Feed