2. Question: One of main constituents of a salad? Answer: SURE!!! But that’s not what we are here for!!! What is Cucumber?
3. Behavior Driven Development and testing tool Bunch of behaviors in the form of scenarios Written mainly by non-technical people Written in plain english What is Cucumber actually?
4. Write a behavior in the form of scenario in a feature file Write the code in order to satisfy the scenario(the actual application and not the automation script) Run the feature file Watch it fail Write the automation script with the template provided by cucumber The behavior of the application is satisfied by the test script What should you actually do?
5. I am sorry but I am not going to discuss the merits and demerits of BDD Behavior Driven Development?
6. Project root/ Features fileName1.feature fileName2.feature Support Env.rb Step_definitions fileName1.rb fileName2.rb Directory structure
7. Feature: Title As a [role] I want [feature] So that [benefit] Scenario: Title Given [context] When [event] And [more event] Then [outcome] And [another outcome] Lets get straight to it!!!
9. Feature: Login As an admin I want be able to login with my credentials So that I get to the home page Scenario: Able to successfully login Given that I am on page “http://www.blahblah.com” When I provide my username “admin” And I provide my password “admin” Then I should be at “HomePage” Example
10. Develop the application driven by the behavior described earlier in the feature file Develop!!!
14. Given /^I am on "([^amp;quot;]*)"$/ do |url| pending end When /^I enter username "([^amp;quot;]*)"$/ do |userName| pending end When /^I enter password "([^amp;quot;]*)"$/ do |password| pending end When /^I click the button with name "([^amp;quot;]*)"$/ do |buttonValue| pending end Then /^I should be at "([^amp;quot;]*)"$/ do |url| pending end What should I do?
15. They are called step definitions Essentially bunch of ruby code A library called Watir is used for the API What was that?
18. Given /^I am on "([^amp;quot;]*)"$/ do |url| @browser.goto(url) end When /^I enter username "([^amp;quot;]*)"$/ do |userName| pending end When /^I enter password "([^amp;quot;]*)"$/ do |password| pending end When /^I click the button with name "([^amp;quot;]*)"$/ do |buttonValue| pending end Then /^I should be at "([^amp;quot;]*)"$/ do |url| pending end Make the necessary changes
19. Go back to step definitions and write the script in order to satisfy the behavior
20. Keep on running the feature file until all of them turns green like a Cucumber