Hi All,
I am completely new to the cucumber though I've good knowledge about
RUBY+watir which I've used for agile testing since long time.
I just want to make a sample cucumber test and run it.
Scenario say :- go to
www.google.com
search with the term "Lancet"
click the search button
check lancet present
I've installed ruby version as ruby 1.8.7 (2010-06-23 patchlevel 299)
[i386-mingw32]
then installed gem install cucumber,
then installed gem install watir
I am using "Start command prompt with Ruby "
now i created three following things
C:\test\features\sample.feature
C:\test\features\step_definitions\sample.rb
C:\test\features\support\env.rb
contents of sample.feature
Feature: Search
In order to learn more
As an information seeker
I want to find more information
Scenario: Find what I'm looking for
Given I am on the Google search page
When I search for "Lancet"
Then I should see
"""
Lancet
"""
contents of sample.rb
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'win32ole'
Given 'I am on the Google search page' do
@browser.goto '
http://www.google.com/'
end
When /I search for "(.*)"/ do |query|
@browser.text_field(:name, 'q').set(query)
@browser.button(:name, 'btnG').click
end
Then /I should see/ do |text|
@browser.text.should =~ /#{text}/m
end
contents of env.rb
begin require 'rspec/expectations'; rescue LoadError; require 'spec/
expectations'; end
if ENV['FIREWATIR']
require 'firewatir'
Browser = FireWatir::Firefox
else
case RUBY_PLATFORM
when /darwin/
require 'safariwatir'
Browser = Watir::Safari
when /win32|mingw/
require 'watir'
Browser = Watir::IE
when /java/
require 'celerity'
Browser = Celerity::Browser
else
raise "This platform is not supported (#{PLATFORM})"
end
end
# "before all"
browser = Browser.new
Before do
@browser = browser
end
# "after all"
at_exit do
browser.close
end
Please let me know if any wrong anywhere.
now i run from ruby command prompt
and getting following errors
C:\test>cucumber sample
no such file to load -- spec/expectations (LoadError)
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original
_require'
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
C:/test/features/support/env.rb:1
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original
_require'
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
rb_support/
rb_language.rb:141:in `load_code_file'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother
.rb:108:in `load_code_file'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother
.rb:100:in `load_code_files'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother
.rb:99:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother
.rb:99:in `load_code_files'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
cli/main.rb
:53:in `execute!'
C:/Ruby187/lib/ruby/gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
cli/main.rb
:25:in `execute'