Search This Blog

Saturday, October 9, 2010

How to install Ruby on Rails for web testing automation


Overview



This document outlines the installation of the Test Automation Ruby on Rails application for web testing automation. It has been tested on Windows XP and Server 2003, but should work with Vista, 7, and Server 2008. Administrative user permissions are preferable for this install. The below tables provide reference to sources of software needed throughout the install.

Required Software(exact versions below are Required for proper installation):
Software
URL
Ruby for windows: ruby186-26.exe
rubygems-1.3.7.zip
MySql Database: mysql-essential-5.0.83-win32.msi
(or mysql-noinstall-5.0.83-win32.zip if admin access not available)
mysql-gui-tools-5.0-r17-win32.msi
dbi-dbd-mysql.zip
Provided
jruby-bin-1.4.0.zip
Provided
browser.rb
Provided
deploy_n.n.n[_xxx].zip
Provided
vendor_n.n.n.zip
Provided


Additional Tools(optional)
Tool
URL
7-zip compression tool (7z465.msi)
eclipse-SDK-3.5.2-win32.zip
UnxUtils.zip


Step-by-Step Install Instructions(follow in order):

Install Ruby 1.8.6.26

1.       Run the ruby one-click self installer(it should run from above link): ruby186-26.exe

2.       After ruby is installed, update rubygems:

Issue following commands from command line:

set http_proxy=http://proxy.xxxxx.com:80
gem update --system

3.       Install the following gems:

   gem install mongrel
   gem install roo
   gem install spreadsheet
   gem install google-spreadsheet-ruby
   gem install mysql
   gem install watir
   gem install rubyzip

All other required gems are installed in the applications vendor/ directory.

Install MySQL 5.0.83:

Note: MySQL 5.1.x versions are known to have problems playing nicely with Rails 2.3.x

If you have admin access under windows use the msi essentials(mysql-essential-5.0.83-win32.msi),
otherwise use the 32 bit zip file (mysql-noinstall-5.0.83-win32.zip). 

If using the MSI file, choose complete installation for multi-use.

1.       Set the root password to ‘waftt’
2.       Set the checkbox so that the ../bin directory will be added to path.
3.       Install as service!
4.       Set port to 9999 (default is 3306 but that gets Windows confused...)

If using the zip file, unzip to Program Files/ using paths in the zip file.
1.       Add the ../bin directory to path
2.       Copy my.ini to the MySQL root path.
3.       Do not start mysql yet!

Install MySQL 5.0 GUI tools:

1.       Run the mysql-gui-tools-5.0-r17-win32.msi self installer (it should run from above link).

Install waft:

1.       Create a waftt/ directory under program files and change to that directory.
2.       Unzip deploy_n.n.n[_xxx].zip using paths
3.       Unzip vendor_n.n.n.zip using paths.
(WHERE: n.n.n is version number AND xxx is (optional) project acronym)




Register AutoItX3.dll:

1.        Open command window
2.       Change to \Program Files\waftt\vendor\gems\watir-1.6.5\lib\watir
3.       Execute 'regsvr32 AutoItX3.dll'

Install Test Automation database:

Open MySQL Administrator and log on as root  using the password you created above.

If you have installed using the .zip file, start the service

1.       Edit /program_files/waftt/config/database.yml to set username to root and password to ‘waftt’ for all three environments (development, test, production).
2.       Open command window to /Program files/waftt
3.       Run the following commands:
rake db:create:all
rake db:schema:load

Open MySQL query browser as root:
1.       Run command: select * from schema_migrations
2.       Delete the following row: 20100416225210
3.       Click Edit at bottom
4.       Right click on the row
5.       Select Delete row(s)
6.       Click Apply Changes

Run In command window:
rake db:migrate
A rake error saying something about 'reenable' is ok. Keep going.
rake db:seed:loaddemo

In MySQL Administrator
1.       Refresh catalog view
2.       In User Administration create user waftt with password waftt
3.       Assign waftt all schema privileges for schemae waftt, waftt_test, and waftt_development
4.       Apply changes

 Restart the MySQL service (Service Control)

Edit /program_files/waftt/config/database.yml again to reset username to ‘waftt’ and password to ‘waftt’ for all three environments (development, test, production).

If the service won't restart check the xxx.err log(s) in the data directory.
If it is complaining about 3306 already in use, reboot and try again.
If the problem persists edit the my.ini file to use 9999 instead of 3306.
 If it is complaining about the InnoDB log file size, edit my.ini to change to 5M.


Starting MySQL when not installed as service

If you are using the zip installation, the mysql driver will not start automatically.
You can do one of two things:

1.       Execute the wafttmysqlserver.cmd script ONCE whenever you reboot.  The window will disappear but the process is still running.
OR
2.       From a cmd.exe window execute 'mysql-nt --install' to run as a service if you have admin rights.

If you have problems, look in the ../data directory for files ending in .err. 
They will contain helpful information.
Refer to Install Test Automation database above for additional information.


Load Simulation setup

1.       Unzip jruby-1.4.0.zip to your C drive under \Program Files
2.       Add c:\Program Files\jruby-1.4.0\bin to your path (after your ruby\bin path entry)
3.       In command window
4.       Now install celerity: (do the set proxy if you haven't done so in this window)
5.       Run following command:
jruby -S gem install celerity -v 0.7.7

6.       Unzip dbi-dbd-mysql.zip (to C:\ or to a temporary directory)
7.       Change to each folder ( .\dbd-mysql-0.4.4 and .\dbi-0.4.3 )
8.       Execute commands below in each folder:
            ruby setup.rb config
            ruby setup.rb setup
            ruby setup.rb install

9.       Copy ./doc/browser.rb file to C:\Program Files\jruby-1.4.0\lib\ruby\gems\1.8\gems\celerity-0.7.7\lib\celerity\


Start Test Automation:

1.       Navigate to Program Files/waftt/ (either in command window or windows explorer)
2.       Execute wafttservices.cmd, this will start the services Test Automation needs in order to run. You should now have the following windows running minimized:

                                                   rails server
 rake jobs:work 1
 ring server
 regression server 1
 load server 1

They should remain running.



Use Test Automation:

1.       Open firefox ( IE will be forced closed by the running scripts as a workaround for some IE and Watir issues not yet resolved.)
2.       Go to http:/localhost:3000. You should see a login page. If you do not already have a registered id you can log in as tester/tester. If the rails server window won't stay open, reboot and try again, or close all the remaining waftt windows and run localwafttservices.cmd. Then use http:/localhost:9191

SEE THE WAFTT USER GUIDE FOR ACCOUNT SETUP AND WAFTT USER INSTRUCTIONS