Как не нужно писать Gherkin
         сценарии!

           или о том, как извлечь
           максимальную пользу
            от Acceptance Tests
Andrii Dzynia
Test Engineer/Consultant/Trainer



                @adzynia




         http://adzynia.com
Клиенты
О чем будем говорить
    Что такое приемочные
            тесты?


       Что такое BDD?


    Примеры написания
    приемочных тестов
Разработка через приемочное
       тестирование
Что такое приемочный тест?


Acceptance testing is a test conducted to
determine if the requirements of a specification
or contract are met
Приемочный тест от тестировщика
Given scrum master open main page
And click Backlog link
Then he should see a list of user stories
When he clicks on “Add New” link
Then he should see Add Story form
When he types “US-309 Create new user” under user story
name field
And he types “Description-Test” under user story description
field
And he types …..
And click submit button
Then message “User Story added” should be present
Приемочный тест от разработчика
Given “scrum master” open “main” page
And click “Backlog” link
Then should see an “empty” list of user stories
When click “Add New” link
Then should see “Add Story” form
When he types “US-309 Create new user” under “storyName”
field
And type “Description-Test” under “storyDescription” field
And type …..
And click “submit” button
Then message “User Story added” should be present
Приемочный тест от бизнес аналитика


Given I am scrum master
When I am adding new user story into product
backlog
Then I should have an ability to manage all user
stories
“3 Amigos Meeting”




 «Начиная, представляйте конечную цель» (с) Стивен Кови
Золотая середина
Given a Scrum Master wants to add new user
story to product backlog
When adding new user story into product
backlog with name “US-309 Create new user”
and description “Description-Test”
Then system should show “User Story added”
message
Параметры
Given a Scrum Master wants to add new user story to
product backlog
When adding new user story into product backlog with
name <storyName> and description <storyDescription>
Then system should show “User Story added” message

Examples:
|     storyName          | storyDescription |
| US-309 Create new user | Description-Test |
| US-310 Edit user       | Full Description |
Таблицы
Given a Scrum Master wants to add new user
story to product backlog
When adding new user story into product backlog
with data
|      storyName         | storyDescription |
| US-309 Create new user | Description-Test |
| US-310 Edit user       | Full Description |
Then system should show “User Story added”
message
Регулярные выражения
@Given(“^a Scrum Master wants to add new user story to product backlog$”)
public void aScrumMasterWantsToAddUserStory()

@When(“^adding new user story into product backlog with name ”(.*)” and
description ”(.*)” $”)
public void addNewUserStoryIntoProductBacklog(List<String> list)

@When(“^adding new user story into product backlog with data”)
public void addNewUserStoryIntoProductBacklog(List<UserStory> list)

@Then(“^system should show ”(.*)” message”)
public void systemShouldShowMessage(String message)
Functionality Matrix

                                 Functional Block 1

                      Feature Feature Feature Feature Feature
                         1       2       3       4       5
      User Story 1      X
      User Story 2               X
Epic 1 User Story 3                               X
      User Story 4                                      X
Epic 2 User Story 5              X       X
src/test/recources/acceptance/functional-block-1/

-   Feature-1.feature
-   Feature-2.feature
-   Feature-3.feature
-   Feature-4.feature
-   Feature-5.feature
Feature 1
@done
Feature:

@UserStory1 @UserStory3
Scenario:

@Pending @UserStory2
Scenario:
Инструменты
Рекомендации
Попробуйте правило 3-х амиго
     для сложных задач

Не пишите приемочные тесты на
    работу UI компонентов

 Пишите приемочные тесты на
  бизнес логику приложения

     Делайте рефакторинг
      приемочных тестов
http://adzynia.com




   @adzynia


  me@adzynia.com

Как не нужно писать Gherkin сценарии

  • 1.
    Как не нужнописать Gherkin сценарии! или о том, как извлечь максимальную пользу от Acceptance Tests
  • 2.
  • 3.
  • 4.
    О чем будемговорить Что такое приемочные тесты? Что такое BDD? Примеры написания приемочных тестов
  • 5.
  • 6.
    Что такое приемочныйтест? Acceptance testing is a test conducted to determine if the requirements of a specification or contract are met
  • 7.
    Приемочный тест оттестировщика Given scrum master open main page And click Backlog link Then he should see a list of user stories When he clicks on “Add New” link Then he should see Add Story form When he types “US-309 Create new user” under user story name field And he types “Description-Test” under user story description field And he types ….. And click submit button Then message “User Story added” should be present
  • 8.
    Приемочный тест отразработчика Given “scrum master” open “main” page And click “Backlog” link Then should see an “empty” list of user stories When click “Add New” link Then should see “Add Story” form When he types “US-309 Create new user” under “storyName” field And type “Description-Test” under “storyDescription” field And type ….. And click “submit” button Then message “User Story added” should be present
  • 9.
    Приемочный тест отбизнес аналитика Given I am scrum master When I am adding new user story into product backlog Then I should have an ability to manage all user stories
  • 10.
    “3 Amigos Meeting” «Начиная, представляйте конечную цель» (с) Стивен Кови
  • 11.
    Золотая середина Given aScrum Master wants to add new user story to product backlog When adding new user story into product backlog with name “US-309 Create new user” and description “Description-Test” Then system should show “User Story added” message
  • 12.
    Параметры Given a ScrumMaster wants to add new user story to product backlog When adding new user story into product backlog with name <storyName> and description <storyDescription> Then system should show “User Story added” message Examples: | storyName | storyDescription | | US-309 Create new user | Description-Test | | US-310 Edit user | Full Description |
  • 13.
    Таблицы Given a ScrumMaster wants to add new user story to product backlog When adding new user story into product backlog with data | storyName | storyDescription | | US-309 Create new user | Description-Test | | US-310 Edit user | Full Description | Then system should show “User Story added” message
  • 14.
    Регулярные выражения @Given(“^a ScrumMaster wants to add new user story to product backlog$”) public void aScrumMasterWantsToAddUserStory() @When(“^adding new user story into product backlog with name ”(.*)” and description ”(.*)” $”) public void addNewUserStoryIntoProductBacklog(List<String> list) @When(“^adding new user story into product backlog with data”) public void addNewUserStoryIntoProductBacklog(List<UserStory> list) @Then(“^system should show ”(.*)” message”) public void systemShouldShowMessage(String message)
  • 15.
    Functionality Matrix Functional Block 1 Feature Feature Feature Feature Feature 1 2 3 4 5 User Story 1 X User Story 2 X Epic 1 User Story 3 X User Story 4 X Epic 2 User Story 5 X X
  • 16.
    src/test/recources/acceptance/functional-block-1/ - Feature-1.feature - Feature-2.feature - Feature-3.feature - Feature-4.feature - Feature-5.feature
  • 17.
  • 18.
  • 19.
    Рекомендации Попробуйте правило 3-хамиго для сложных задач Не пишите приемочные тесты на работу UI компонентов Пишите приемочные тесты на бизнес логику приложения Делайте рефакторинг приемочных тестов
  • 20.
    http://adzynia.com @adzynia me@adzynia.com