Watir and Cucumber
April 8, 2011
This is the best website to start cucumber with watir
For more details http://cukes.info
CukeUp
April 8, 2011
CukeUp! takes place in London on March 24th 2011. It’s a one day conference packed with half hour talks about all things related to the Cucumber BDD tool and ecosystem.
CukeUp! is organized by Skills Matter and Aslak Hellesøy, the creator of Cucumber. Sign up at the Skills Matter web site.
Talks will cover topics like:
- Cucumber basics
- How to keep Cucumber features maintainable and fast
- Outside-in Development and BDD
- Browser testing of Ruby, Java, .NET or PHP apps
- Related tools and techniques
- Keep the team involved with a ubiquitous language
This mixture of technical and non-technical talks should be beneficial for programmers, testers and people who write requirements.
Special thanks to DRW Trading Group for sponsoring this conference.
For more details –> http://bit.ly/j_cukeup
Cucumber — DRY up your Steps
October 20, 2010
Way 1:
Feature File:
Scenario: Google
Given I am in Google Search page
When the user clicks on the next button
When clicks next
When selects Next
Then the title should be “Raveendran – Watir”
In your ruby file,
Given /^I am in Google Search page$/ do
puts “I am in google page”
end
When /^(?:the? )?(?:user? )?(?:clicks|selects)?(?: on? )?(?:the?)?(?: next?)?(?: button?)?$/i do
puts “The same script working for 3 step files
“
end
Then /^the title should be (.*)$/ do |arg1|
#Code for verification
puts “It works”
end
Solution :
Only 1 step is enough Instead of 3 steps if it targets same script.
Way 2:
Feature File:
Scenario: Google
Given I have verified the result page
When nothing changed
Then the title should be “Raveendran – Watir”
In Your Ruby file,
Given /^I have verified the result page$/ do
Given “I am in Google Search page”
And “the user clicks on the next button”
And “clicks next”
And “selects Next”
And “the title should be “Raveendran – Watir”"
end
When /^nothing changed$/ do
#Some Code
end
Then /^the title should be “([^\"]*)”$/ do |arg1|
#Some Code
end
HYDRA – Ruby gem
September 23, 2010
Hydra is a distributed testing framework. It allows you to distribute your tests locally across multiple cores and processors, as well as run your tests remotely over SSH.
Hydra’s goals are to make distributed testing easy. So as long as you can ssh into a computer and run the tests, you can automate the distribution with Hydra.
nstalling Hydra
Installing Hydra is easy, just install the gem:
gem install hydra OR Download the gem file from http://gemcutter.org and install itSetting up Hydra
To set up Hydra, you need to edit your project’s Rakefile and add this code:
# require the hydra codebase require 'hydra' # require the hydra rake task helpers require 'hydra/tasks'Adding Cucumber Files
# set up a new hydra testing task named 'hydra:cucumber' run with "rake hydra:cucumber"
Hydra::TestTask.new('hydra:cucumber') do |t|
# add all files in the features directory that end with ".feature"
t.add_files 'features/**/*.feature'
end
Adding Test::Unit Files
# set up a new hydra testing task named 'hydra:units' run with "rake hydra:units"
Hydra::TestTask.new('hydra:units') do |t|
# add all files in the test/unit directory recursively that
# end with "_test.rb"
t.add_files 'test/unit/**/*_test.rb'
# and test/functional
t.add_files 'test/functional/**/*_test.rb'
# and test/integration
t.add_files 'test/integration/**/*_test.rb'
end
Adding RSpec Files
# set up a new hydra testing task named 'hydra:spec' run with "rake hydra:spec"
Hydra::TestTask.new('hydra:spec') do |t|
# you may or may not need this, depending on how you require
# spec_helper in your test files:
require 'spec/spec_helper'
# add all files in the spec directory that end with "_spec.rb"
t.add_files 'spec/**/*_spec.rb'
end
cuRF
August 5, 2010
cuRF - It will create Cucumber feature files with different set of test data.
Installation:
- Download and Install Ruby from –> http://www.ruby-lang.org/en/downloads/
- In Command prompt
- >gem install rasta
- >gem install parseexcel
- >gem install rspec –v1.2.9 (Uninstall if RSpec 1.3.0 installed)
- >gem install win32ole-pp
- Rasta Framework –> http://rasta.rubyforge.org/
Usage:
- Create multiple Cucumber Feature files with different set of TEST DATA.
Why it is needed?
- Cucumber currently supports Keyword driven and TABLE structured data driven flows. The table structure data driven works perfectly within Scenario’s. But it doesn’t pass anything to ANTOHER scenario’s in same feature file.
- To increase the data driven approach in cucumber, we are creating more feature files depends upon TEST data from user.
Steps for Demo:
- Open main_feature.feature file
- It has 2 scenario’s
- Instead of TEST DATA it has the variable name such as,
- number1
- number2
- total1
- total2
- These all variables should be unique
- Open data.xls file
- Here you need provide all headers. Header name is nothing but all the variable names without the symbol “@”
- Keep the method name created? At last column.
- Create the rows with TEST DATA
- Save and Close the Excel file
- Run the batch file named as “run.bat”
- Open the folder named as “result_features”
- Lot of new feature files created automatically with the different set of test data.
- Open the folder named as “result_features”
- Demo Video –> http://bit.ly/j_cuRF
- Code –> http://bit.ly/j_cuRF_code

