Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aslakhellesoy/439ac41d9fd914105751 to your computer and use it in GitHub Desktop.
Save aslakhellesoy/439ac41d9fd914105751 to your computer and use it in GitHub Desktop.
Just helping someone create better features: http://irclogger.com/.cucumber/2015-04-30
Feature: Create Healthcare Study Team user account
The back-office users should be able to create a Healthcare
Study Team user account.
Rules:
- The following fields are mandatory:
- Gender (male, female)
- Last Name
- First Name
- Email
- Email must not be used already
- Email must be validated
Questions:
- What do we do with transgender people?
- Do we need to validate Zip code correctness?
- Do we need to validate phone/fax numbers?
Scenario: All fields are filled out correctly
Given the user with email "aslak@cucumber.io" does not exist
When I create a user with email "aslak@cucumber.io" with all fields filled out
Then I should see a confirmation that the account is created
And a confirmation email should be sent to "aslak@cucumber.io"
Scenario: Email is already in use
Given the user with email "aslak@cucumber.io" exists
When I create a user with email "aslak@cucumber.io" with all fields filled out
Then I should see an error message with the text "This email address is already in use"
And no confirmation email should be sent
And I should be given the opportunity to edit the existing account instead
Scenario: Email is invalid
When I create a user with email "aslak#cucumber.io" with all fields filled out
Then I should see an error message with the text "This email address is invalid"
And no confirmation email should be sent
Scenario Outline: Fields are missing
Given the user with email "aslak@cucumber.io" does not exist
When I create a user with email "aslak@cucumber.io" with missing field "<missing_field>"
Then I should see an error message with the text "<error_message>"
And no confirmation email should be sent
Examples:
| missing_field | error_message |
| Last Name | The last name is required |
| First Name | The first name is required |
| Email | The email address is required |
@aslakhellesoy
Copy link
Author

I wrote this to help out in this discussion: http://irclogger.com/.cucumber/2015-04-30

This was the original spec:

And this was the original feature:

Scenario Outline: Creation health care study team account with invalid values
    Given I am authenticated in the web application as a system user
    When I go to the account creation page
    And I try to validate the form with the following values:
      | Gender   | Last Name   | First Name   | Date of Birth   | User ID   | Zip Code    | City    | Country   | State   | Email   | Phone Number    | Mobile Phone    | Fax   |
      | <Gender> | <Last Name> | <First Name> | <Date of Birth> | <User ID> | <Zip Code>  | <City>  | <Country> | <State> | <Email> | <Phone Number>  | <Mobile Phone>  | <Fax> |
    Then I should see <message>
    Examples:
    | Gender  | Last Name | First Name  | Date of Birth | User ID | Zip Code  | City          | Country       | State         | Email               | Phone Number  | Mobile Phone | Fax  | message                                                                               |
    | Male    | John      | Doe         | 24/12/1990    | ABC123  | 13029     | San Francisco | United States | California    | john.doe@domain.tld | 012345678     | 012345678    |      | The account are successfully created and confirmation email shall be sent to the user |
    | Male    | 12345     | Doe         | 24/12/1990    | ABC123  | 13029     | San Francisco | United States | California    | john.doe@domain.tld | 012345678     | 012345678    |      | The last name should only contains letters                                            |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment