Monday, August 8, 2011

Watir Tutorial: Installation

This is actually the second tutorial that I have written for this, and I found that there were several things that I should have covered before trying to tackle text fields within a program, that if you are new at this, would be way beyond what you can do already anyways.  So let's start with something slightly easier, installation!

Really, this should be fairly easy to do, as Watir is well documented enough for installation as far as I can tell, but in case it isn't, I will go step by step through it here, for the benefit of those that come after (in memory of the pioneers). So let's start with Ruby installation then, in case you are completely new to this. 

A bit of history:  Ruby was developed in the mid 90's by Yukihiro Matsumoto, who goes by "Matz", and who also happens to be a member of the LDS Church.  Way to go!

In order to install Ruby on Windows, which if you are working with JD Edwards, I'm assuming you are using, go here.  This is the easiest way to do it, most people refer to it as the "one click installation" or something of the sort, making it pretty easy.

What this will do is put into your start menu a shortcut called "Start command prompt with ruby", pretty neat, huh? 

Now we need to update Ruby, and get the necessary "gems" (a fancy name for libraries, or pre-compiled and packaged bits of programs for our use), so that Watir will work correctly.

Go ahead and click on "Start command prompt with ruby", and follow the installation instructions here



Since we are concerned with using this for JD Edwards testing, we have a little bit more to do so that we can do everything that an end-user could and would do.  One of the problems I have encountered involved the menu-exits on the EnterpriseOne screen, and because of this we have to use a little work around for now, if I solve it later I will be sure to post about that, but for now we need to do a little bit more. 

Go ahead and click here to download a program called "AutoIt".  What this is used for is to emulate key strokes on the keyboard.  When using it, you have to put "require 'win32ole'" at the beginning of your script to load the correct library.  I will be going into it's use more later, in a different tutorial. 



The last thing we have to get, is a little program called TinyTDS.  Finding this little gem(literally and figuratively), took forever.  I want you, the reader, to appreciate just how much trouble this took me to find.  (Because obviously the finder has the harder task than the writer of the actual program).  We run our JDE databases off of SQL Server.  I've read just about every article and forum post out there about connecting ruby to the database and getting it to make some queries for testing.  Obviously I hadn't because I didn't find this program until I got a tip off about the creator of the SQL Server gem itself (@metaskills) whose website is here.  I found there the program that sounded like it would work, and lo and behold it did!

Now, I understand that not everyone out there, having trouble with their database playing nicely with Ruby will find a solution in this.  But maybe someone out there will.  Just remember to ask someone that knows better than you do, after you have done all you can.

TinyTDS has a great source of documentation, that takes a little decyphering but works like a charm, I will be detailing my findings here as well, but here is where to start. 

Remember to "require 'tiny_tds'" after you have executed "gem install tiny_tds" from the command prompt with ruby. 

1 comment:

  1. You might mention that it is recommended to use Ruby 1.8.6 or 1.8.7 on all platforms.

    ReplyDelete