Skip to content

Instantly share code, notes, and snippets.

@s9tpepper
Created July 18, 2013 06:53
Show Gist options
  • Save s9tpepper/6027203 to your computer and use it in GitHub Desktop.
Save s9tpepper/6027203 to your computer and use it in GitHub Desktop.
CucumberJS flow
1. Write Feature file with scenarios
2. Run CucumberJS to make sure I get expected scenario step def stub code
3. Add step defs to Feature_steps.js
4. Add any new utility methods I might need to pass the Feature file scenarios
- For example, if the Feature file is:
Feature: Forgot password link
Scenario: Clicking on the password link sends the user to the forgotpw.html page
Given the user is on the login page
When the user clicks on the forgot password link
Then the user is redirected to the forgot password page
For this feature I might add a goToPage() method to the World, where I can use it like:
this.goToPage('login.html') to set up the Given step. At this point it would fail cuz its not implemented so I'd go to next step
5. Write Jasmine specs (unit tests) to create a login page with a forgot password link that loads the forgotpw.html page when its clicked
6. Pass those Jasmine specs as I write them
7. Once the Jasmine specs have passed to get the functionality I need to load the login page, I move on to the next step def, at that point I'd add another method to the World to trigger clicks on a link so I could use it in the When step def like:
this.clickLink('Forgot Password'); // it would find the appropriate element and trigger a click()
8. Repeat 5-7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment