Skip to content

Example feature

Pablo Veiga edited this page May 6, 2019 · 5 revisions

Feature: Add new user

Scenario: User registration

Variant: Full user registration

Given that I am on "http://localhost:8080"
When I type "admin" in {Username}
  And I type "Administrator" in {Name}
  And I type "admin@email.com" in {Email}
  And I select "male" in {Gender}
  And I check "admin" in {Role}
  And I click {Save}
Then I see "User successfully added"

UI Element: Username

  • id is "#username"
  • placeholder id "Username"
  • minimum length is 3
  • maximum length is 30
  • value is queried by "SELECT username FROM [Users]"

UI Element: Name

  • id is "#name"
  • placeholder is "Name"
  • required is true
  • minimum length is 3
  • maximum length is 100
  • value is queried by "SELECT name FROM [Users]"

UI Element: Email

  • id is "#email"
  • type is "email"
  • required is true
  • placeholder is "Name"
  • minimum length is 3
  • maximum length is 100
  • value is queried by "SELECT email FROM [Users]"

UI Element: Gender

  • id is "#gender"
  • required is true
  • type is select
  • value is queried by "SELECT name FROM Users"

UI Element: Role

  • required is true
  • id is "#role"
  • type is radio
  • value is queried by "SELECT name FROM Users"

Table: Users

name username email
Administrator admin admin@email.com
Bob bob bob@email.com
Mary mary mary@email.com

Table: Genders

name value
Male male
Female female
Other other

Table: Roles

name value
Administrator admin
Manager manager
User user

Full Code

Feature: Add new user

Scenario: User registration 

  Variant: Full user registration
    Given that I am on "http://localhost:8080"
    When I type "admin" in {Username}
      And I type "Administrator" in {Name}
      And I type "admin@email.com" in {Email}
      And I select "male" in {Gender}
      And I check "admin" in {Role}
      And I click {Save}
    Then I see "User successfully added"

UI Element: Username
  - id is "#username"
  - placeholder id "Username" // test
  - minimum length is 3
  - maximum length is 30
  - value is queried by "SELECT username FROM [Users]"

UI Element: Name
  - id is "#name"
  - placeholder is "Name" // test
  - required is true
  - minimum length is 3
  - maximum length is 100
  - value is queried by "SELECT name FROM [Users]"

UI Element: Email
  - id is "#email"
  - type is "email"
  - required is true
  - placeholder is "Name"
  - minimum length is 3
  - maximum length is 100
  - format: // put email pattern
  - value is queried by "SELECT email FROM [Users]"

UI Element: Role
  - id is "#role"
  - required is true
  - type is select
  - value is in ["Administrador", "Gerente", "Usuário"]

UI Element: Gender
  - id is "#gender"
  - required is true
  - type is select
  - value is in ["Masculino", "Feminino"]

UI Element: Eu aceito os termos
  - required is true
  - id is "#terms"
  - type is checkbox

Table: Users
  | name              | username  | email           |
  | Administrator     | admin     | admin@email.com |
  | Bob               | bob       | bob@email.com   |
  | Joey              | joey      | joey@email.com  |