Links
First you need to download Selenium RC and install it. Create this batch in C:Program Files(your selenium RC dir)
@ECHO OFF
java -jar selenium-server.jar
REM -browserSessionReuse
REM -proxyInjectionMode
Install Cucumber for IronPython
Read this documentation on how to install Cucumber with IronPython
Be sure to have icucumber.bat, mine is in IronPython bin
@ECHO OFF
REM This is to tell IronRuby where to find gems.
SET GEM_PATH="C:ironruby-0.9.0libIronRubygems1.8"
@"C:ironruby-0.9.0binir.exe" "C:ironruby-0.9.0bincucumber" %*
- Install Notepad++, so you can edit those pesky ruby files
- install
- gem install Selenium
- gem install watir
Create Cucumber features and steps
insertnew.feature
Feature: Insert New Contact
In order to insert a new contact
As a MediaWiki Authenticated user
I want to fill the form fields
Scenario Outline: Add Contact
Given I am on the Add Contact Form
And I entered user <FirstName>
And last name <LastName>
And e-mail <Email>
And bio <Bio>
And birthday <Birthday>
When I click Save Page
Then I should wait for the page to display the results
Examples:
|FirstName | LastName | Email | Bio | Birthday |
| Cliff | Heath | ch@google.com | http://www.google.com | 29 |
insertnew_steps.rb
Given /^I am on the Add Contact Form$/ do
@browser.open(‘http://myWebServerApp’)
end
Given "I entered user $value" do |value|
@browser.type "input_2", value
end
Given "last name $value" do |value|
@browser.type "input_3", value
end
Given "e-mail $value" do |value|
@browser.type "input_4", value
end
Given "bio $value" do |value|
@browser.type "input_5", value
end
Given "birthday $value" do |value|
@browser.type "input_6_day", value
end
When /I click Save Page/ do
@browser.click "wpSave"
@browser.wait_for_page_to_load
end
Then /wait for the page to display/ do
end
env.rb
require ‘spec/expectations’
require ‘selenium’
# "before all"
browser = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://www.google.com", 15000)
Before do
@browser = browser
@browser.start
end
After do
@browser.stop
end
# "after all"
at_exit do
browser.close rescue nil
end
Your feature folder is
features
–step_definitions
—*.rb
–support
—env.rb
*.feature
How to test
1. Run Selenium Batch
2. Run feature: icucumber features –no-color
http://www.batteryfast.co.uk/hp/nc6100.htm Hp nc6100 Battery http://www.batteryfast.co.uk/hp/nc6120.htm Hp nc6120 Battery http://www.batteryfast.co.uk/hp/nc6400.htm Hp nc6400 Battery http://www.batteryfast.co.uk/hp/nx6100.htm Hp nx6100 Battery http://www.batteryfast.co.uk/hp/nx6120.htm Hp nx6120 Battery http://www.batteryfast.co.uk/hp/pavilion-dv2000.htm Hp pavilion dv2000 Battery http://www.batteryfast.co.uk/hp/pavilion-dv6000.htm Hp pavilion dv6000 Battery http://www.batteryfast.co.uk/toshiba/pa3285u-3brs.htm Toshiba pa3285u-3brs Battery http://www.batteryfast.co.uk/sony/vgp-bps2.htm Sony vgp-bps2 Battery http://www.batteryfast.co.uk/sony/vgp-bps2a.htm Sony vgp-bps2a Battery http://www.batteryfast.co.uk/sony/vgp-bps2b.htm Sony vgp-bps2b Battery http://www.batteryfast.co.uk/sony/vgp-bps2c.htm Sony vgp-bps2c Battery http://www.batteryfast.co.uk/toshiba/pa3451u.htm Toshiba pa3451u Battery http://www.batteryfast.co.uk/toshiba/pa3451u-1brs.htm Toshiba pa3451u-1brs Battery http://www.batteryfast.co.uk/toshiba/pa3534u-1brs.htm Toshiba pa3534u-1brs Battery http://www.batteryfast.co.uk/laptop-ac-adapter/dell/1720.htm Dell 1720 Adapter http://www.batteryfast.co.uk/hp/pavilion-dv2000.htm HP pavilion dv2000 Battery http://www.batteryfast.co.uk/hp/pavilion-dv6000.htm HP pavilion dv6000 Battery http://www.batteryfast.co.uk laptop battery http://www.batteryfast.co.uk laptop batteries http://www.batteryfast.co.uk/dell/ dell laptop battery http://www.batteryfast.co.uk/dell/ dell laptop batteries http://www.batteryfast.co.uk/hp/ hp laptop battery http://www.batteryfast.co.uk/hp/ hp laptop batteries http://www.batteryfast.co.uk/dell/ dell laptop battery http://www.batteryfast.co.uk/dell/ dell laptop batteries http://www.batteryfast.co.uk laptop battery http://www.batteryfast.co.uk laptop batteries http://www.batteryfast.co.uk/dell/ dell laptop battery http://www.batteryfast.co.uk/dell/ dell laptop batteries http://www.batteryfast.co.uk/hp/ hp laptop battery http://www.batteryfast.co.uk/hp/ hp laptop batteries http://www.batteryfast.co.uk/dell/ dell laptop battery http://www.batteryfast.co.uk/dell/ dell laptop batteries http://www.batteryfast.co.uk/toshiba/ toshiba laptop battery http://www.batteryfast.co.uk/toshiba/ toshiba laptop batteries http://www.batteryfast.co.uk/sony/ sony laptop battery http://www.batteryfast.co.uk/sony/ sony laptop batteries http://www.batteryfast.co.uk/acer/as07b51.htm Acer as07b51 Battery http://www.batteryfast.co.uk/acer/as07b52.htm Acer as07b52 Battery http://www.batteryfast.co.uk/acer/as07b71.htm Acer as07b71 Battery http://www.batteryfast.co.uk/acer/as07b72.htm Acer as07b72 Battery http://www.batteryfast.co.uk/acer/aspire-5500.htm Acer aspire 5500 Battery http://www.batteryfast.co.uk/acer/aspire-one-zg5.htm Acer aspire one zg5 Battery http://www.batteryfast.co.uk/acer/black-aspire-one-zg5.htm Acer black aspire one zg5 Battery