Saturday 5 May 2018

Gherkin: Doc Strings

If the text is not fit into single line, then you can put that text in
""" Large Text """.

Unsubscribe.feature
Feature: User unsubscription

 Scenario: Unsubscribe the user
  If the subscribed user want to unsubscribe from the application, he/she should be unsubscribed and a mail should be sent.
  
  Given I am a subscribed user
  When I choose to unsubscribe
  Then I should be unsubscribed
  And I should receive an email containing
  """
   Dear User,
   
    You are successfully unsubscribed.
    
   Best Regards
  """

Cucumber generates below skelton.
@Given("^I am a subscribed user$")
public void i_am_a_subscribed_user() throws Exception {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I choose to unsubscribe$")
public void i_choose_to_unsubscribe() throws Exception {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I should be unsubscribed$")
public void i_should_be_unsubscribed() throws Exception {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I should receive an email containing$")
public void i_should_recevie_an_email_containing(String arg1) throws Exception {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}





Previous                                                 Next                                                 Home

No comments:

Post a Comment