Last Updated on March 14, 2019 by admin
Watir – Web Application Testing in Ruby – I’m thinking about adding this as part of my standard Rails integration tests. I like the idea of capturing keystokes that a user might actually run. Plus, it makes for a dandy demo tool.
Here’s the summary of installation steps. I’m assuming you’re Rails-aware enough to have an application in place, and you know how to install Ruby gems:
Rails Side –
gem install watir
gem install tg4rb
Firefox Side –
Install the TestGen4Web add-on
Install the JSSH extension – start here to determine which version, and follow all the instructions on the page.
Once you restart Firefox, the TestGen4Web icon should be in the lower right hand corner – you click on that to bring up the tool bar. Then it’s just a matter of starting the record, capturing the keystrokes, stop recording, and then save the captured keystrokes to a file. The content will be XML, so use a .xml extension.
From the command line – sorry, Command Prompt window in MS-speak, run tg4rb on the file you saved: tg4rb /tmp/mykeystrokefile.xml – you will get a mykeystrokefile.rb in the same folder location.
Then run ruby mykeystrokefile.rb, and watch the magic.
I’ll add another blog about actually using this stuff, and I also need to see if I can do this on a Linux machine. Stay tuned.
PS – I can’t believe it’s been a month since my last blog. What a slacker. 8>)