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

Post A Comment!

2007-Feb-23 - So right

Posted by PeteNairn
Absolutely right, Phil, tools are not just for automating tests. We use QTP and we regularly write scripts just to do things and check things. It is often the most effective way.

Of course, I wouldn't buy QTP only for that and there would be other ways of doing the same thing, but having the expertise to hand and the tool, why not?
Permanent Link

2007-Feb-27 - Using wc for wordcount

Posted by Anonymous
I use the Unix "wc" command to count lines, words, and characters. If you install the free Cygwin environment on Windows, you'll get wc by default.

But when you can whip out a short chunk of code, that's a fine solution too.

By the way, be careful how you're counting carriage returns and linefeeds when you use tools like this - they can throw off your numbers, which is a problem if you need a precise count.

-Danny Faught
http://tejasconsulting.com/
Permanent Link

2007-May-2 - Poetry

Posted by paul@gerrardconsulting.com
Hey! you are in the wrong business.
<br>
<br>I read and reread your post.
<br>
<br>There is definitly a rhythm and symmetry of the language.
<br>
<br>A bit like a Haikku.
<br>
<br>But not.
Permanent Link

<- Last PageNext 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
JakeBrake
jpweston
metalbaby
thepthial
EklecticTester
michaeljf
PeteNairn
jimtest
spikyone

Syndication

RSS Site Feed