Watir — Integration with Fitnesse

Fitnesse –Open source Test managment and acceptance testing tool

Watir –Open source Functional testing tool

 

1. Download the JAR file from http://fitnesse.org/FrontPage.FitNesseDevelopment.DownLoad

2. Save it in d:\fitnesse\fitnesse.jar

3. Install Ruby

4. Install the gem fit with the help of command

>gem install fit

>gem install watir

5. Open Command Prompt and navigate to

D:\fitness>java -jar fitnesse.jar

FitNesse (v20100103) Started…
port:              80
root page:         fitnesse.wiki.FileSystemPage at ./FitNesseRoot
logger:            none
authenticator:     fitnesse.authentication.PromiscuousAuthenticator
html page factory: fitnesse.html.HtmlPageFactory
page version expiration set to 14 days.

6. Open Browser and Navigate to “http://localhost/”

7. Click Properties or Navigate to “http://localhost/FrontPage?properties”

Change as per the snapshot and click Save Properties


8. Click “Edit”

Paste this code

!define COMMAND_PATTERN {ruby -I %p C:/ruby/lib/ruby/gems/1.8/gems/fit-1.2/bin/FitServer.rb}
!path D:/fit
!|mytest.Division|
|term|result_term|search?|
|Raveendran |music |true|
|Ruby |program |true|

9. In D:\ create folder named as “fit”
“Fit” folder should contain another one forlder named as “mytest”
“mytest” folder should contain “division.rb”

10.

Open division.rb file

paste the code

require ‘fit/column_fixture’
require ‘rubygems’
require ‘watir’

module Mytest

class Division < Fit::ColumnFixture
attr_accessor :term, :result_term
def search
@ie=Watir::IE.new
@ie.goto(“google.com”)
puts “Entering Term”
@ie.text_field(:name,’q’).set(@term)
@ie.button(:name,’btnG’).click
@output = @ie.text.include?(@result_term)
@ie.close
return @output

end
end

end

11. Click “Test” in “http://localhost&#8221;

12. Fitnesse will provide the test result for your definitions. For ex, see the snapshot

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s