Discussion:
[Cucumber] Scenario outlines doubt
(too old to reply)
Pablo Leon
2018-02-20 22:46:38 UTC
Permalink
Raw Message
Hi everybody, I'm learning cucumber and I have a doubt about the output of
my scenario outlines when I'm trying to adopt a puppy.
Scenario runs and all the steps pass but them remain as undefined and I
don't know if that is ok due to in some videos from 'Chezzy' I have seen
that the steps pass and every steps are well defined, I think that I have
the same that in 'Chezzy' exercises but I don't know why they remain as
undefined, even I can't see that the checkout steps fill the fields of the
puppies adoption page

these are my steps:

require_relative 'adoption_helper'


include AdoptionHelper


Given ("I am on the adoption puppy site") do

goto_the_puppy_adoption_site

end

When ("I click View Details button") do

adopt_puppy_number 0

end

And ("I click the Adopt Me Button") do

confirm_puppy

end

And ("I click the Complete the Adoption button") do

complete_adoption

end

And /ˆI fill the "([ˆ\"]*)" field$/ do |name|

CheckoutPage.name = name

end

And /ˆI fill the "([ˆ\"]*)" field$/ do |address|

CheckoutPage.address = address

end

And /ˆI fill the "([ˆ\"]*)" field$/ do |email|

CheckoutPage.email = email

end

And /ˆI select the "([ˆ\"]*)" to pay$/ do |pay_type|

CheckoutPage.pay_type = pay_type

end

And ("I click the Place Order button") do

CheckoutPage.place_order

end

Then /ˆI should see "([ˆ\"]*)"$/ do |message|

expect(@browser.text).to include message

end


This is my feature & scenario

Feature: Adopting puppies Using Scenario Outlines

As a puppy lover

I want to adopt puppies

With different scenarios

So they can chew my furniture


Background:

Given I am on the adoption puppy site



Scenario Outline: Adopting a puppy

When I click View Details button

And I click the Adopt Me Button

And I click the Complete the Adoption button

And I fill the "<name>" field

And I fill the "<address>" field

And I fill the "<email>" field

And I select the "<pay_type>" to pay

And I click the Place Order button

Then I should see "Thank you for adopting a puppy!"

Examples:

|name |address |email |
pay_type |

|Pablo |La chora 123 |***@aclora |Check
|

|Carlota |Jardin Real 2|***@aclora |Purchase
order|

|Sergio |Robada angula|***@aclora |Check
|


This is my CheckoutPage class

class CheckoutPage





include PageObject





def name(name)


@browser.text_field(:id => 'order_name').set(name)


end


def address(address)


@browser.textarea(:id => 'order_address').set(address)


end


def email(email)


@browser.text_field(:id => 'order_email').set(email)


end


def pay_type(pay_type)


@browser.select_list(:id => 'order_pay_type').select(pay_type)


end


def place_order


@browser.button(:value => 'Place Order').click


end


end


And this is the output that I get

Feature: Adopting puppies Using Scenario Outlines

As a puppy lover

I want to adopt puppies

With different scenarios

So they can chew my furniture


Background:

Given I am on the adoption puppy site


Scenario Outline: Adopting a puppy

When I click View Details button

And I click the Adopt Me Button

And I click the Complete the Adoption button

And I fill the "<name>" field

And I fill the "<address>" field

And I fill the "<email>" field

And I select the "<pay_type>" to pay

And I click the Place Order button

Then I should see "Thank you for adopting a puppy!"


Examples:

| name | address | email | pay_type |

| Pablo | La chori 123 | ***@aclora | Check |

| Carlota | Jardin Real 2 | ***@aclora | Purchase order |

| Sergio | Robada angula | ***@aclora | Check |


3 scenarios (3 undefined)

30 steps (6 skipped, 12 undefined, 12 passed)

0m26.035s


You can implement step definitions for undefined steps with these snippets:


When("I fill the {string} field") do |string|

pending # Write code here that turns the phrase above into concrete
actions

end


When("I select the {string} to pay") do |string|

pending # Write code here that turns the phrase above into concrete
actions

end

Plus this is my 'adoption_helper' (module)

module AdoptionHelper

def goto_the_puppy_adoption_site

@browser = Watir::Browser.new :chrome

@browser.goto ('puppies.herokuapp.com')

end


def adopt_puppy_number(num)

@browser.button(:value => 'View Details', :index =>
num).click

sleep 2

end


def confirm_puppy

@browser.button(:value => 'Adopt Me!').click

sleep 2

end


def complete_adoption

@browser.button(:value => 'Complete the Adoption').click

end

end
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...