-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial revision with everything running in parallel
- Loading branch information
Sean Grove
committed
Sep 20, 2010
0 parents
commit a0caf80
Showing
8 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default: --format html --out <%= ENV['SELENIUM_REPORT_FILENAME'] %> --format pretty -r features/support/env.rb -r features/support/enhanced.rb -r features/step_definitions features/enhanced |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: As a user, I want search results returned | ||
|
||
Scenario Outline: Return Search Results for a term | ||
Given I am on the Google Homepage | ||
When I enter a "<term>" | ||
Then the search results should include "<result>" | ||
|
||
Examples: Correct Results | ||
| term | result | | ||
| banana | fruit | | ||
| cheese | Cheddar | | ||
|
||
Examples: Incorrect Results | ||
| term | result | | ||
| banana | Jim Hacker | | ||
| cheese | Humphrey Appleby | | ||
| steak | Bernard Woolley | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Given /^I am on the Google Homepage$/ do | ||
@browser.open "/" | ||
end | ||
|
||
When /^I enter a "([^\"]*)"$/ do |term| | ||
@browser.type "q", term | ||
@browser.click "btnG" | ||
end | ||
|
||
Then /^the search results should include "([^\"]*)"$/ do |result| | ||
source = @browser.get_html_source | ||
raise Exception unless source.include?(result) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
host = ENV['host'] || "http://google.com" | ||
|
||
ondemand = YAML.load_file("ondemand.yml") | ||
|
||
Before do |scenario| | ||
outline = scenario.scenario_outline | ||
job_name = "#{outline.name.capitalize}: #{scenario.name}" | ||
|
||
@browser = Selenium::Client::Driver.new( | ||
:host => "saucelabs.com", | ||
:port => 4444, | ||
:browser => | ||
{ | ||
"username" => ondemand["username"], | ||
"access-key" => ondemand["api_key"], | ||
"os" => ENV['SELENIUM_BROWSER_OS'], | ||
"browser" => ENV['SELENIUM_BROWSER_NAME'], | ||
"browser-version" => ENV['SELENIUM_BROWSER_VERSION'], | ||
"job-name" => job_name | ||
}.to_json, | ||
:url => host, | ||
:timeout_in_second => 90) | ||
|
||
@browser.start_new_browser_session | ||
end | ||
|
||
After do |scenario| | ||
@browser.close_current_browser_session | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'selenium/client' | ||
require 'json' | ||
require 'yaml' | ||
|
||
Before do |scenario| | ||
end | ||
|
||
# "after all" | ||
at_exit do | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'cucumber/formatter/unicode' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
username: your-sauce-labs-username | ||
api_key: your-sauce-labs-api-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'rubygems' | ||
require 'cucumber/rake/task' | ||
require 'selenium/rake/tasks' | ||
require 'parallel' | ||
|
||
# Change these to specify which browsers on which | ||
# platforms you want to cover | ||
@browsers = [{:os => "Windows 2003", :name => "iehta", :version => "6."}, | ||
{:os => "Windows 2003", :name => "iehta", :version => "7."}, | ||
{:os => "Windows 2003", :name => "iehta", :version => "8."}, | ||
{:os => "Windows 2003", :name => "firefox", :version => "3."}, | ||
{:os => "Windows 2003", :name => "safari", :version => "4."}, | ||
{:os => "Windows 2003", :name => "googlechrome", :version => ""}] | ||
|
||
|
||
desc "Invoke behaviours on all browsers on specified platform" | ||
task :test do | ||
year, month, day = Date.today.strftime("%Y,%m,%d").split(",") | ||
dir = "reports/#{year}/#{month}" | ||
FileUtils::mkdir_p(dir) | ||
|
||
Parallel.map(@browsers, :in_processes => @browsers.count) do |browser| | ||
begin | ||
ENV['SELENIUM_BROWSER_OS'] = browser[:os] | ||
ENV['SELENIUM_BROWSER_NAME'] = browser[:name] | ||
ENV['SELENIUM_BROWSER_VERSION'] = browser[:version] | ||
ENV['SELENIUM_REPORT_FILENAME'] = "#{dir}/#{day}-#{browser[:os]}_#{browser[:name]}_#{browser[:version]}.html".gsub(/\s/, "_").gsub("..", ".") | ||
|
||
year, month, day = Date.today.strftime("%Y,%m,%d").split(",") | ||
dir = "reports/#{year}/#{month}" | ||
|
||
Rake::Task[ :run_browser_tests ].execute({ :browser_name => browser[:name], | ||
:browser_version => browser[:version], | ||
:browser_od => browser[:os] }) | ||
rescue RuntimeError | ||
puts "Error while running task" | ||
end | ||
end | ||
end | ||
|
||
Cucumber::Rake::Task.new(:'run_browser_tests') do |t| | ||
t.cucumber_opts = "--format pretty --format html features" | ||
end | ||
|
||
task :default => [:test] |