|
| 1 | +This proof of concept demonstrates using cucumber to do searches. |
| 2 | + |
| 3 | +Also, you may want to look at "this tutorial":http://watir.com/2011/01/22/simple-cucumber-watir-page-object-pattern-framework/ |
| 4 | +and "this blog series":http://www.cheezyworld.com/2010/12/16/ui-tests-putting-it-all-together/ |
| 5 | + |
| 6 | +Test using Rake |
| 7 | +=============== |
| 8 | + |
| 9 | + $ rake -T |
| 10 | + |
| 11 | + rake default # Run Cucumber features |
| 12 | + rake prod # Run Cucumber features |
| 13 | + |
| 14 | +Installation |
| 15 | +============ |
| 16 | + |
| 17 | +This code is written in ruby and tested on 1.8.7 |
| 18 | + |
| 19 | + $ ruby -v |
| 20 | + ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0] |
| 21 | + |
| 22 | +You will also require the installation of the following GEMS via the commands: |
| 23 | + |
| 24 | + gem install rake |
| 25 | + gem install rspec |
| 26 | + gem install watir-webdriver |
| 27 | + gem install cucumber |
| 28 | + |
| 29 | + $ gem list |
| 30 | + |
| 31 | + *** LOCAL GEMS *** |
| 32 | + |
| 33 | + childprocess (0.3.1, 0.1.9) |
| 34 | + cucumber (1.1.8, 0.3.97, 0.2.3, 0.1.12, 0.1.10) |
| 35 | + multi_json (1.0.4) |
| 36 | + rake (0.8.7, 0.8.3) |
| 37 | + rspec (2.6.0, 1.3.0, 1.2.8, 1.2.2, 1.1.11, 1.1.8, 0.5.15) |
| 38 | + rspec-core (2.6.3) |
| 39 | + rspec-expectations (2.6.0) |
| 40 | + rspec-mocks (2.6.0) |
| 41 | + rspec_generator (0.5.15) |
| 42 | + rubygems-update (1.3.6, 1.3.5, 1.3.1, 1.3.0) |
| 43 | + selenium-webdriver (2.19.0, 0.2.0) |
| 44 | + term-ansicolor (1.0.7, 1.0.4, 1.0.3) |
| 45 | + watir-webdriver (0.5.3) |
| 46 | + |
| 47 | +Sammple run |
| 48 | +=========== |
| 49 | + |
| 50 | + $ rake |
| 51 | + (in /Users/todd/Documents/src/AutomationTutorial) |
| 52 | + /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-1.1.8/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-1.1.8/bin/cucumber" --profile default |
| 53 | + Using the default profile... |
| 54 | + Code: |
| 55 | + * features/support/env.rb |
| 56 | + * config/config_common.rb |
| 57 | + * config/config_dev.rb |
| 58 | + * features/pages/bing_search_page.rb |
| 59 | + * features/pages/google_search_page.rb |
| 60 | + * features/step_definitions/search_steps.rb |
| 61 | + |
| 62 | + Features: |
| 63 | + * features/search.feature |
| 64 | + Parsing feature files took 0m0.047s |
| 65 | + |
| 66 | + Feature: |
| 67 | + Potential Assurity customers need to be able to find company information, services and address details when searching on the internet |
| 68 | + |
| 69 | + Scenario: # features/search.feature:4 |
| 70 | + Given I am using google # features/step_definitions/search_steps.rb:1 |
| 71 | + When I search for 'Assurity' # features/step_definitions/search_steps.rb:5 |
| 72 | + Then the top result should be 'Assurity - Ensuring Software Health - Welcome' # features/step_definitions/search_steps.rb:10 |
| 73 | + |
| 74 | + Scenario: # features/search.feature:9 |
| 75 | + Given I am using google # features/step_definitions/search_steps.rb:1 |
| 76 | + When I search for 'test agile new zealand' # features/step_definitions/search_steps.rb:5 |
| 77 | + Then the results include the text 'Assurity' # features/step_definitions/search_steps.rb:14 |
| 78 | + You need to find the appropriate method on google_search_page (Cucumber::Pending) |
| 79 | + ./features/step_definitions/search_steps.rb:15:in `/^the results include the text '(.*)'$/' |
| 80 | + features/search.feature:12:in `Then the results include the text 'Assurity'' |
| 81 | + |
| 82 | + 2 scenarios (1 pending, 1 passed) |
| 83 | + 6 steps (1 pending, 5 passed) |
| 84 | + 0m8.368s |
0 commit comments