background preloader

Cucumber

Facebook Twitter

Cucumber, capybara, webdriver example for a non-rails app. Cucumber webdriver example for a non rails app. In the last project, I have worked on writing automated tests for a rails application. The technology stack we used was Cucumber, Selenium 1.0.x, Ruby on Rails. I tried to find for some Cucumber sample tests for non rails applications but couldn't find anything very useful. If you happen to know/find out, let me know. Cucumber (software) A feature definition, with a single scenario:[9] Feature: Division In order to avoid silly mistakes Cashiers must be able to calculate a fraction Scenario: Regular numbers * I have entered 3 into the calculator * I press divide * I have entered 2 into the calculator * I press equal * The result should be 1.5 on the screen The execution of the test implicit in the feature definition above requires the definition, using the Ruby language, of a few "steps":[10] Before do @calc = Calculator.newend After doend Given /I have entered (\d+) into the calculator/ do |n| @calc.push n.to_iend When /I press (\w+)/ do |op| @result = @calc.send op end Then /the result should be (.*) on the screen/ do |result| @result.should == result.to_fend.

Cucumber (software)

Pragmatic Forums.