Step 2: Creating the step method

Create a new step class. The class must:

  • Provide step methods for the new steps.
  • Inject ContextFactory

For step 2, you must create an AdminSteps_Ext file to contain step methods for the new steps.

The following text is an example of a new EmailSteps_Ext class.

package gw.cucumber.customer.steps.admin

uses com.google.inject.Inject
uses cucumber.api.java.en.Given
uses cucumber.api.java.en.Then
uses cucumber.api.java.en.When
uses gw.cucumber.context.api.ContextFactory
// additional uses statements may be needed

class EmailSteps_Ext {

   @Inject
  var _contextFactory : ContextFactory

   @Given ("^I am the supervisor of \"([^\"]*)\"$")
  public function getTeamMember(userName : String) {
    _contextFactory.getAdminContext_Ext().getTeamMember(userName)
  }

   @When ("^I set the user's email address to \"([^\"]*)\"$")
  public function iSetTheUserEmailAddress(emailAddress : String) {
    _contextFactory.getAdminContext_Ext().setUserEmailAddress(emailAddress)
  }

   @Then ("^the user's primary email address should be \"([^\"]*)\"$")
  public function theEmailAddressShouldBe(emailAddress : String) {
    _contextFactory.getAdminContext_Ext().verifyEmailAddress(emailAddress)
  }

}

For more information on creating step methods, see Creating step methods.