'

Behavior Driven Development: Writing Better Scenarios

Понравилась презентация – покажи это...





Слайд 0

Behavior Driven Development Writing better scenario E BDD? oing lly d rea You Are Arnauld LOYER — @aloyer Mastering Software Development


Слайд 1

Disclaimer No scenario has been harmed during the investigation Most remarks are purely subjectives github search: extension:feature travel/deal/… @aloyer


Слайд 2

Let’s try to diagnose the maturity Anti-Pattern … an antipattern was something that seems like a good idea when you begin, but leads you into trouble. http://martinfowler.com/bliki/AntiPattern.html @aloyer


Слайд 3

Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior and discover unknowns C @aloyer


Слайд 4

dy? Rea


Слайд 5

Functional T ests or BDD ? @aloyer


Слайд 6

Functional T ests or BDD ? @aloyer


Слайд 7

Functional T ests or BDD ptance Acce ? @aloyer


Слайд 8

BDD ? Feature: The Confluence server is up
 
 
 In order to make sure that Confluence has been installed and runs
 As a developer
 I want to access Confluence's home page
 Scenario: Developer accesses the home page
 Given the url of Confluences home page
 When a web user browses to the url
 Then the connection should be successful
 Then the page status should be OK
 Then the page should have the title "Confluence Setup Wizard - Confluence" https://github.com/xebia-france/chef-confluence-jira-crowd/blob/a26e29a85d1e75b9b612a560685940b40c971adc/test/integration/confluence-jira-crowd/cucumber/confluence_up.feature @aloyer


Слайд 9

BDD ? Sanity Check Feature: The Confluence server is up
 
 
 In order to make sure that Confluence has been installed and runs
 As a developer
 I want to access Confluence's home page
 Scenario: Developer accesses the home page
 Given the url of Confluences home page
 When a web user browses to the url
 Then the connection should be successful
 Then the page status should be OK
 Then the page should have the title "Confluence Setup Wizard - Confluence" behavior ? https://github.com/xebia-france/chef-confluence-jira-crowd/blob/a26e29a85d1e75b9b612a560685940b40c971adc/test/integration/confluence-jira-crowd/cucumber/confluence_up.feature @aloyer


Слайд 10

BDD ? Sanity Check Feature: The Confluence server is up
 
 
 In order to make sure that Confluence has been installed and runs
 As a developer
 I want to access Confluence's home page
 Scenario: Developer accesses the home page
 Given the url of Confluences home page
 When a web user browses to the url
 Then the connection should be successful
 Then the page status should be OK
 Then the page should have the title "Confluence Setup Wizard - Confluence" behavior ? https://github.com/xebia-france/chef-confluence-jira-crowd/blob/a26e29a85d1e75b9b612a560685940b40c971adc/test/integration/confluence-jira-crowd/cucumber/confluence_up.feature @aloyer


Слайд 11

Ti ps Given-When-Then 3 phase s Given a context /arrange setup When an event happens exercise/act Then an outcome should be observed verify/assert @aloyer 12


Слайд 12

BDD ? Feature: Asset Manager
 
 
 @local-network
 @normal
 Scenario: check an asset can be loaded
 Given I am testing "asset-manager"
 And I am an authenticated API client
 When I visit "/assets/513a0efbed915d425e000002"
 Then I should get a 200 status code
 And I should see "120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 @normal
 Scenario: check an asset can be served
 Given I am testing "static"
 When I visit "/media/ 513a0efbed915d425e000002/120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 Then I should get a 200 status code
 And I should get a content length of "212880" https://github.com/alphagov/smokey/blob/4c8fe739938e4a4b8b7bb393dfd485efd39dc034/features/asset_manager.feature @aloyer


Слайд 13

BDD 
 Feature: Asset Manager
 ? T echnical T est web page Selenium 
 @local-network
 @normal
 ails Scenario: check an asset can be loaded
 hnical det te c Given I am testing "asset-manager"
 And I am an authenticated API client
 When I visit "/assets/513a0efbed915d425e000002"
 Then I should get a 200 status code
 And I should see "120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 @normal
 Scenario: check an asset can be served
 Given I am testing "static"
 When I visit "/media/ 513a0efbed915d425e000002/120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 Then I should get a 200 status code
 And I should get a content length of "212880" ss Language? Busine https://github.com/alphagov/smokey/blob/4c8fe739938e4a4b8b7bb393dfd485efd39dc034/features/asset_manager.feature @aloyer


Слайд 14

BDD ? T echnical T est on-sustainable Unclear and n 
 Feature: Asset Manager
 
 @local-network
 es? ifferenc d @normal
 Scenario: check an asset can be loaded
 Given I am testing "asset-manager"
 And I am an authenticated API client
 When I visit "/assets/513a0efbed915d425e000002"
 Then I should get a 200 status code
 And I should see "120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 @normal
 Scenario: check an asset can be served
 Given I am testing "static"
 When I visit "/media/ 513a0efbed915d425e000002/120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 Then I should get a 200 status code
 And I should get a content length of "212880" s? nt result differe https://github.com/alphagov/smokey/blob/4c8fe739938e4a4b8b7bb393dfd485efd39dc034/features/asset_manager.feature @aloyer


Слайд 15

Let’s try to diagnose the maturity T ests BDD Business Behavior Cucumber Tech’ @aloyer


Слайд 16

Should I use cucumber to write technical tests? Be pragmatic! Who will read the scenario? Are you ready to pay the cucumber overhead? compared to raw xUnit tests Do you really contribute to a shared knowledge or do you increase the business/technical gap? @aloyer


Слайд 17

& ad re Who write the scenario ? @aloyer


Слайд 18

C Business/PO ? N L Developer Tester @aloyer


Слайд 19

Who wrote this ? Feature: Asset Manager
 
 
 @local-network
 @normal
 Scenario: check an asset can be loaded
 Given I am testing "asset-manager"
 And I am an authenticated API client
 When I visit "/assets/513a0efbed915d425e000002"
 Then I should get a 200 status code
 And I should see "120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 @normal
 Scenario: check an asset can be served
 Given I am testing "static"
 When I visit "/media/ 513a0efbed915d425e000002/120613_Albania_Travel_Advice_WEB_Ed2_jpeg.jpg"
 Then I should get a 200 status code
 And I should get a content length of "212880" https://github.com/alphagov/smokey/blob/4c8fe739938e4a4b8b7bb393dfd485efd39dc034/features/asset_manager.feature @aloyer


Слайд 20

Forgot the rule ? @MoveToken
 Feature: Moving the token over the board
 
 
 As a player
 I want to move to new positions on the board
 So that I can get rich and win the game
 
 Scenario Outline: Moving a token after a single throw
 Given players token is at starting position <startingPosition>
 When player throws die1 <die1> and die2 <die2>
 Then players token moves to a new position <newPosition>
 Examples:
 | startingPosition | 1 | 2 | 39 | | | | die1 1 3 2 | | | | die2 2 4 2 | | | | newPosition 4 9 3 |
 |
 |
 |
 https://github.com/xebia/spec-by-example-2014-09-29/blob/4eabded6b22e816f6509a3ecd2c2180b62f4d73d/src/test/resources/monopoly/cucumber/MoveToken.feature @aloyer


Слайд 21

Forgot the rule ? @MoveToken
 Feature: Moving the token over the board
 
 
 As a player
 I want to move to new positions on the board
 So that I can get rich and win the game
 
 The AllInOne Eff ect Scenario Outline: Moving a token after a single throw
 Given players token is at starting position <startingPosition>
 When player throws die1 <die1> and die2 <die2>
 Then players token moves to a new position <newPosition>
 Examples:
 | startingPosition | 1 | 2 | 39 | | | | die1 1 3 2 | | | | die2 2 4 2 | | | | newPosition 4 9 3 |
 |
 |
 |
 le? is the ru where https://github.com/xebia/spec-by-example-2014-09-29/blob/4eabded6b22e816f6509a3ecd2c2180b62f4d73d/src/test/resources/monopoly/cucumber/MoveToken.feature @aloyer


Слайд 22

Forgot the rule ? th e @MoveToken
 Feature: Moving the token over the board
 
 
 As a player
 I want to move to new positions on the board
 So that I can get rich and win the game
 
 outl ine eff ect The AllInOne Eff ect Scenario Outline: Moving a token after a single throw
 Given players token is at starting position <startingPosition>
 When player throws die1 <die1> and die2 <die2>
 Then players token moves to a new position <newPosition>
 Examples:
 | startingPosition | 1 | 2 | 39 | | | | die1 1 3 2 | | | | die2 2 4 2 | | | | newPosition 4 9 3 |
 |
 |
 |
 le? is the ru where https://github.com/xebia/spec-by-example-2014-09-29/blob/4eabded6b22e816f6509a3ecd2c2180b62f4d73d/src/test/resources/monopoly/cucumber/MoveToken.feature @aloyer


Слайд 23

? Is the rule obvious 
 Feature: Deal team invitations
 
 1. A "My deals" section with
 The deals that I created
 The deals on which me or my team are deal leaders
 The deals on which me or my team are deal members
 
 
 2. A "Other deals" section with:
 The deals for which me or my team are "other contact"
 Scenario Outline: People invited into deal team directly
 Given the following deals have been created
 | Name | Creator | User leaders | User members | User other contacts |
 | AF | John | Charlotte | Peter | Diego |
 | KLM | Charlotte | John | Charlotte | Peter |
 | IB | Charlotte | Charlotte | John | Peter |
 | GW | Diego | Charlotte | Peter | John |
 | TAP | Diego | Charlotte | Peter | |
 | TUN | Diego | Charlotte | Peter | Matthieu |
 When <user> logs into the platform
 Then the My deals section should have only <my deals>
 And the Other deals section should have only <other deals>
 Examples:
 | user | John | Charlotte | Peter | Matthieu | Mariem | | | | | | my deals | other deals AF, KLM, IB | GW AF, KLM, IB, GW, TAP, TUN | <none> AF, GW, TAP, TUN | KLM, IB <none> | TUN <none> | <none> |
 |
 |
 |
 |
 | @aloyer


Слайд 24

? S RE Is the rule obvious A 
 Feature: Deal team invitations
 
 1. A "My deals" section with
 The deals that I created
 The deals on which me or my team are deal leaders
 The deals on which me or my team are deal members
 
 
 2. A "Other deals" section with:
 The deals for which me or my team are "other contact"
 Scenario Outline: People invited into deal team directly
 Given the following deals have been created
 | Name | Creator | User leaders | User members | User other contacts |
 | AF | John | Charlotte | Peter | Diego |
 | KLM | Charlotte | John | Charlotte | Peter |
 | IB | Charlotte | Charlotte | John | Peter |
 | GW | Diego | Charlotte | Peter | John |
 | TAP | Diego | Charlotte | Peter | |
 | TUN | Diego | Charlotte | Peter | Matthieu |
 When <user> logs into the platform
 Then the My deals section should have only <my deals>
 And the Other deals section should have only <other deals>
 Examples:
 | user | John | Charlotte | Peter | Matthieu | Mariem | | | | | | my deals | other deals AF, KLM, IB | GW AF, KLM, IB, GW, TAP, TUN | <none> AF, GW, TAP, TUN | KLM, IB <none> | TUN <none> | <none> |
 |
 |
 |
 |
 |


Слайд 25

? S RE Is the rule obvious A 
 Feature: Deal team invitations
 
 1. A "My deals" section with
 The deals that I created
 The deals on which me or my team are deal leaders
 The deals on which me or my team are deal members
 
 
 2. A "Other deals" section with:
 The deals for which me or my team are "other contact"
 th e outl ine eff ect I belong what if … s to mul tiple gro up? Scenario Outline: People invited into deal team directly
 Given the following deals have been created
 | Name | Creator | User leaders | User members | User other contacts |
 | AF | John | Charlotte | Peter | Diego |
 | KLM | Charlotte | John | Charlotte | Peter |
 | IB | Charlotte | Charlotte | John | Peter |
 | GW | Diego | Charlotte | Peter | John |
 | TAP | Diego | Charlotte | Peter | |
 | TUN | Diego | Charlotte | Peter | Matthieu |
 When <user> logs into the platform
 Then the My deals section should have only <my deals>
 And the Other deals section should have only <other deals>
 Examples:
 | user | John | Charlotte | Peter | Matthieu | Mariem | | | | | | my deals | other deals AF, KLM, IB | GW AF, KLM, IB, GW, TAP, TUN | <none> AF, GW, TAP, TUN | KLM, IB <none> | TUN <none> | <none> |
 |
 |
 |
 |
 |


Слайд 26

? S RE Is the rule obvious A 
 Feature: Deal team invitations
 
 1. A "My deals" section with
 The deals that I created
 The deals on which me or my team are deal leaders
 The deals on which me or my team are deal members
 
 
 2. A "Other deals" section with:
 The deals for which me or my team are "other contact"
 th e outl ine eff ect I belong what if … s to mul tiple gro up? Scenario Outline: People invited into deal team directly
 Given the following deals have been created
 | Name | Creator | User leaders | User members | User other contacts |
 | AF | John | Charlotte | Peter | Diego |
 | KLM | Charlotte | John | Charlotte | Peter |
 | IB | Charlotte | Charlotte | John | Peter |
 | GW | Diego | Charlotte | Peter | John |
 | TAP | Diego | Charlotte | Peter | |
 | TUN | Diego | Charlotte | Peter | Matthieu |
 When <user> logs into the platform
 Then the My deals section should have only <my deals>
 And the Other deals section should have only <other deals>
 Examples:
 | user | John | Charlotte | Peter | Matthieu | Mariem | | | | | | my deals | other deals AF, KLM, IB | GW AF, KLM, IB, GW, TAP, TUN | <none> AF, GW, TAP, TUN | KLM, IB <none> | TUN <none> | <none> |
 |
 |
 |
 |
 |


Слайд 27

the A4 rule ? 
 Feature: Deals display order in the home page
 As an FO
 I need to see my deals ordered in the way that fits my function
 In order to have a clear view of the most important or urgent deals.
 
 
 Clarifications:
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For cards display, the oldest cards will be on the top and for cards on the same row, the oldest card will be on the left.
 For table display, the oldest cards will on the top.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | Aircraft AF | Air France | Aircraft KLM | KLM | Aircraft TUN | Tunisair | | | | total amount 150000000 15000000 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte | | | | user members Peter Charlotte Charlotte | | | | user other contacts | expected closing date | pricing status | Credit approval status | Lso deal code | Cwf request code Diego | May 12, 2016 | true | Not submitted | L0377450 | 2015_07_001105 Peter | Jul 11, 2014 | false | In progress | L0377451 | 2015_08_001105 Peter | Jul 12, 2014 | false | In progress | L0377451 | 2015_09_001105 | | | | stage Marketing Bidding Bidding | | | | confidentiality level |
 My Team |
 Confidential |
 My Team |
 When Charlotte logs into the platform
 Then the My deals section must be ordered as Aircraft KLM,Aircraft TUN,Aircraft AF
 @aloyer


Слайд 28

the A4 rule ? 
 Feature: Deals display order in the home page
 As an FO
 I need to see my deals ordered in the way that fits my function
 In order to have a clear view of the most important or urgent deals.
 
 
 Clarifications:
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For cards display, the oldest cards will be on the top and for cards on the same row, the oldest card will be on the left.
 For table display, the oldest cards will on the top.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | Aircraft AF | Air France | Aircraft KLM | KLM | Aircraft TUN | Tunisair | | | | total amount 150000000 15000000 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte | | | | user members Peter Charlotte Charlotte | | | | user other contacts | expected closing date | pricing status | Credit approval status | Lso deal code | Cwf request code Diego | May 12, 2016 | true | Not submitted | L0377450 | 2015_07_001105 Peter | Jul 11, 2014 | false | In progress | L0377451 | 2015_08_001105 Peter | Jul 12, 2014 | false | In progress | L0377451 | 2015_09_001105 | | | | stage Marketing Bidding Bidding | | | | confidentiality level |
 My Team |
 Confidential |
 My Team |
 When Charlotte logs into the platform
 Then the My deals section must be ordered as Aircraft KLM,Aircraft TUN,Aircraft AF
 Feature: Deals display order in the home page
 
 
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | total amount | AF | Air France | 150000000 | KLM | KLM | 15000000 | TUN | Tunisair | 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte When Charlotte logs into the platform
 Then the My deals section must be ordered as KLM, TUN, AF | | | | user memb Peter Charlotte Charlotte


Слайд 29

the A4 rule ? 
 Feature: Deals display order in the home page
 As an FO
 I need to see my deals ordered in the way that fits my function
 In order to have a clear view of the most important or urgent deals.
 
 
 Clarifications:
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For cards display, the oldest cards will be on the top and for cards on the same row, the oldest card will be on the left.
 For table display, the oldest cards will on the top.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | Aircraft AF | Air France | Aircraft KLM | KLM | Aircraft TUN | Tunisair | | | | total amount 150000000 15000000 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte | | | | user members Peter Charlotte Charlotte | | | | user other contacts | expected closing date | pricing status | Credit approval status | Lso deal code | Cwf request code Diego | May 12, 2016 | true | Not submitted | L0377450 | 2015_07_001105 Peter | Jul 11, 2014 | false | In progress | L0377451 | 2015_08_001105 Peter | Jul 12, 2014 | false | In progress | L0377451 | 2015_09_001105 | | | | stage Marketing Bidding Bidding | | | | confidentiality level |
 My Team |
 Confidential |
 My Team |
 When Charlotte logs into the platform
 Then the My deals section must be ordered as Aircraft KLM,Aircraft TUN,Aircraft AF
 Feature: Deals display order in the home page
 
 
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | total amount | AF | Air France | 150000000 | KLM | KLM | 15000000 | TUN | Tunisair | 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte When Charlotte logs into the platform
 Then the My deals section must be ordered as KLM, TUN, AF | | | | user memb Peter Charlotte Charlotte


Слайд 30

the A4 rule ? 
 Feature: Deals display order in the home page
 As an FO
 I need to see my deals ordered in the way that fits my function
 In order to have a clear view of the most important or urgent deals.
 
 
 Clarifications:
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For cards display, the oldest cards will be on the top and for cards on the same row, the oldest card will be on the left.
 For table display, the oldest cards will on the top.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | Aircraft AF | Air France | Aircraft KLM | KLM | Aircraft TUN | Tunisair | | | | total amount 150000000 15000000 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte | | | | user members Peter Charlotte Charlotte | | | | user other contacts | expected closing date | pricing status | Credit approval status | Lso deal code | Cwf request code Diego | May 12, 2016 | true | Not submitted | L0377450 | 2015_07_001105 Peter | Jul 11, 2014 | false | In progress | L0377451 | 2015_08_001105 Peter | Jul 12, 2014 | false | In progress | L0377451 | 2015_09_001105 | | | | stage Marketing Bidding Bidding | | | | confidentiality level |
 My Team |
 Confidential |
 My Team |
 When Charlotte logs into the platform
 Then the My deals section must be ordered as Aircraft KLM,Aircraft TUN,Aircraft AF
 Feature: Deals display order in the home page
 
 
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | total amount | AF | Air France | 150000000 | KLM | KLM | 15000000 | TUN | Tunisair | 16000000 | | | | creator Johny Charlotte Johny | | | | B user leaders Charlotte Johny Charlotte When Charlotte logs into the platform
 Then the My deals section must be ordered as KLM, TUN, AF | | | | user memb Peter Charlotte Charlotte


Слайд 31

the A4 rule ? 
 Feature: Deals display order in the home page
 As an FO
 I need to see my deals ordered in the way that fits my function
 In order to have a clear view of the most important or urgent deals.
 
 
 Clarifications:
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For cards display, the oldest cards will be on the top and for cards on the same row, the oldest card will be on the left.
 For table display, the oldest cards will on the top.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | client name | Aircraft AF | Air France | Aircraft KLM | KLM | Aircraft TUN | Tunisair | | | | total amount 150000000 15000000 16000000 | | | | creator Johny Charlotte Johny | | | | user leaders Charlotte Johny Charlotte | | | | user members Peter Charlotte Charlotte | | | | user other contacts | expected closing date | pricing status | Credit approval status | Lso deal code | Cwf request code Diego | May 12, 2016 | true | Not submitted | L0377450 | 2015_07_001105 Peter | Jul 11, 2014 | false | In progress | L0377451 | 2015_08_001105 Peter | Jul 12, 2014 | false | In progress | L0377451 | 2015_09_001105 | | | | stage Marketing Bidding Bidding | | | | confidentiality level |
 My Team |
 Confidential |
 My Team |
 When Charlotte logs into the platform
 Then the My deals section must be ordered as Aircraft KLM,Aircraft TUN,Aircraft AF
 Feature: Deals display order in the home page
 
 
 Deals should be ordered by expected closing date, the first deals displayed should be the ones with the oldest expected closing date.
 For deals with the same expected closing date, they should be ordered by deal name
 Scenario: Deals display order
 Given the following deals
 | name | expected closing date |
 | AF | May 12, 2016 |
 | KLM | Jul 11, 2014 |
 | TUN | Jul 12, 2014 | O When Charlotte logs into the platform
 Then the My deals section must be ordered as KLM, TUN, AF


Слайд 32

Let’s try to diagnose the maturity T ests BDD Business Behavior Cucumber Tech’ @aloyer


Слайд 33

Let’s try to diagnose the maturity T ests BDD Business Behavior 3 Amigos Cucumber Tech’ @aloyer


Слайд 34

Let’s try to diagnose the maturity T ests BDD Business Behavior 3 Amigos Scenario Cucumber Tech’ @aloyer


Слайд 35

Let’s try to diagnose the maturity T ests Driven Development Behavior 3 Amigos Scenario Cucumber BDD Business Tech’ @aloyer


Слайд 36

Scenario should be written using the Business Language Together What is the intent? Have I understood the expected behavior? Do I clearly understand the rule when reading a scenario? How many rules are exposed within the scenario? Try to limit to One rule per scenario @aloyer


Слайд 37

Writing better scenario What level of details ? @aloyer


Слайд 38

Enough details ? @BuyingProperties
 Feature: Buying properties
 
 
 As a player
 I want to buy properties
 So that I can ask rent when my opponents land on it
 
 Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 And I receive the title deed
 
 Scenario: No sufficient funds
 Given I land on unowned property
 And my funds are not sufficient
 Then I am not able to buy the property
 https://github.com/xebia/workshop-agile-testing/blob/8705e3f93270662285cd9c8ec8c24e5ac957f3ed/src/test/resources/features/BuyingProperties.feature @aloyer


Слайд 39

Enough details ? @BuyingProperties
 Feature: Buying properties
 too 
 decla rati ve 
 As a player
 I want to buy properties
 So that I can ask rent when my opponents land on it
 
 Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 And I receive the title deed
 
 Scenario: No sufficient funds
 Given I land on unowned property
 And my funds are not sufficient
 Then I am not able to buy the property
 h one? whic t does it mean? w ha Choose? « Pay » is an outcome? https://github.com/xebia/workshop-agile-testing/blob/8705e3f93270662285cd9c8ec8c24e5ac957f3ed/src/test/resources/features/BuyingProperties.feature @aloyer


Слайд 40

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 And I receive the title deed @aloyer


Слайд 41

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 And I receive the title deed 
 @default_properties
 Scenario: Buying property
 
 Given I land on unowned "west" property
 And my funds are 2000
 When I buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased to 1800 @aloyer


Слайд 42

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 And I receive the title deed 
 @default_properties
 Scenario: Buying property
 
 Given I land on unowned "west" property
 And my funds are 2000
 When I buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased to 1800 to pay is an action (when) not an outcome (then) value can be changed can help to project to other case Can it always be applied? @aloyer


Слайд 43

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 And I receive the title deed 
 @default_properties
 Scenario: Buying property
 
 Given I land on unowned "west" property
 And my funds are 2000
 When I buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased to 1800 @Then("^my funds should be (?:decreased to |increased to )?(\\d+)$")
 public void my_funds_should_be_(int amount) @aloyer


Слайд 44

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 
 And I receive the title deed @default_properties
 Scenario: Buying property
 
 Given I land on unowned "west" property
 And my funds are 2000
 When I buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased to 1800 @default_properties
 Scenario: Default properties - by tag
 Then the available properties should be at least:
 | name | price |
 | east | 150 |
 | west | 200 |
 | north | 100 |
 | south | 40 | @aloyer


Слайд 45

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 
 And I receive the title deed @default_properties
 Scenario: Buying property
 
 Given I land on unowned "west" property
 And my funds are 2000
 When I buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased to 1800 @default_properties
 Scenario: Default properties - by tag
 Then the available properties should be at least:
 | name | price |
 | east | 150 |
 | west | 200 |
 Scenario: Default properties - explicit
 | north | 100 |
 Given the default properties are used
 | south | 40 | Then the available properties should be at least:
 | name | price |
 | east | 150 |
 | west | 200 |
 | north | 100 |
 | south | 40 | @aloyer


Слайд 46

Scenario: Buying property
 Given I land on unowned property
 And my funds are sufficient
 When I choose to buy the property
 Then I pay the printed price
 
 And I receive the title deed @default_properties
 Scenario: Buying property
 
 Given I land on unowned "west" property
 And my funds are 2000
 When I buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased to 1800 
 @default_properties @default_player
 Scenario: Buying property
 
 
 Given I land on unowned "west" property that cost 180
 When I choose to buy the property
 And I pay the printed price
 Then I should receive the "west" title deed
 And my funds should be decreased by 180 @aloyer


Слайд 47

T much details oo Scenario: Create a Stock option ? Scenario: Create a Fund option Given the following option: | Property | delivery | bo strike | floor | forex constat | forex constat date | forex start date | guaranteed currency | guaranteed rate | initial spot ... | maturity | option quotity | strike | underlying id | underlying type Given the following option: | | | | | | | | | | Value Cash no 0 1970-JAN-01 1970-JAN-01 EUR 0 0 | | | | | | | | | | | | | | | 2020-FEB-05 1 2500 SOCIETE-GLE_X Stock | | | | | ~53 properties And the option’s restriking infos is: | Property | floating rate | fixed rate ... | last update | first trading date | rate offset | Value | no | no | | | | <now> | <now> | 0.0 | | | | Property | delivery | bo strike | floor | forex constat | forex constat date | forex start date | guaranteed currency | guaranteed rate | initial spot ... | maturity | option quotity | strike | underlying id | underlying type | | | | | | | | | | Value Cash no 0 1970-JAN-01 1970-JAN-01 EUR 0 0 | | | | | | | | | | | | | | | 2020-FEB-05 1 2500 SOCIETE-GLE_X Fund | | | | | And the option’s restriking infos is: ~20 properties When I create the option Then the option id should be filled in | Property | floating rate | fixed rate ... | last update | first trading date | rate offset | Value | no | no | | | | <now> | <now> | 0.0 | | | When I create the option Then the option id should be filled in @aloyer


Слайд 48

T much details oo Scenario: Create an external OTC deal Given the following option: | Property | delivery | bo strike | floor | forex constat | forex constat date | forex start date | guaranteed currency | guaranteed rate | initial spot ... | maturity | option quotity | strike | underlying id | underlying type | | | | | | | | | | Value Cash no 0 1970-JAN-01 1970-JAN-01 EUR 0 0 | | | | | | | | | | | | | | | 2020-FEB-05 1 2500 SOCIETE-GLE_X Stock | | | | | And the option’s restriking infos is: | Property | floating rate | fixed rate ... | last update | first trading date | rate offset | Value | no | no | | | | <now> | <now> | 0.0 | | | ? And an external OTC deal: | Property | category | delivery | initial price | internal market | last update ... | quantity | remaining quantity | | | | | | Value OTC 0 yes <now> | 6000 | 6000 | | | | | | ~58 | | And the deal’s counter part is: | Property | confirm mode | market maker ... | Value | ST | Nefertiti | | | ~22 | | | ~58 | | | ~5 And the deal’s sales part is: | Property | accounting center | derogation ... | Value | | no And the deal’s collateral is: | Property | IA | currency ... | Value | no | - When I create the option And I create the deal with the created option Then the deal id should be filled in @aloyer


Слайд 49

T much details oo ? use pers ona Scenario: Standard option Given a standard option with no specifics Then the option should have the following properties: | Property | delivery | bo strike | floor | forex constat | forex constat date | forex start date | guaranteed currency | guaranteed rate | initial spot ... | maturity | option quotity | strike | underlying id | underlying type | restriking infos | | | | | | | | | | Value Cash no 0 1970-JAN-01 1970-JAN-01 EUR 0 0 | | | | | | | | | | | | | | | | 2020-FEB-05 1 2500 SOCIETE-GLE_X Stock <standard> | | | | | | ecked na is ch ted Perso cumen AND d o ~53 properties Scenario: Standard option’s restriking infos Given a standard option’s restriking infos Then the option’s restriking infos should be: | Property | floating rate | fixed rate ... | last update | first trading date | rate offset | Value | no | no | | | | <now> | <now> | 0.0 | | | ~20 @aloyer


Слайд 50

T much details oo Scenario: Create a Stock option ? use pers ona Given the following option: | Property | delivery | bo strike | floor | forex constat | forex constat date | forex start date | guaranteed currency | guaranteed rate | initial spot ... | maturity | option quotity | strike | underlying id | underlying type | | | | | | | | | | Value Cash no 0 1970-JAN-01 1970-JAN-01 EUR 0 0 | | | | | 2020-FEB-05 1 2500 SOCIETE-GLE_X Stock | Property | floating rate | fixed rate ... | last update | first trading date | rate offset | Value | no | no | | | | | | | | | | Scenario: Create a Stock Option | | | | | Given a standard option with the following specifics: | underlying type | underlying id | | SOCIETE-GLE_X | And the option’s restriking infos is: | Stock | <now> | <now> | 0.0 When I create the option | | Then the option id should be filled in | | | | When I create the option Then the option id should be filled in @aloyer


Слайд 51

Enough details ? http://blog.thiga.fr/product-management/bdd-gherkin-pour-ecrire-vos-user-stories/ @aloyer


Слайд 52

Enough details ? Lot of details there ! no details sult ge the re llen ay to cha no w http://blog.thiga.fr/product-management/bdd-gherkin-pour-ecrire-vos-user-stories/ @aloyer


Слайд 53

Enough details GPS? ? Lot of details there, 6 decimals precision! GPS? - destination is usually an address! http://blog.thiga.fr/product-management/bdd-gherkin-pour-ecrire-vos-user-stories/ @aloyer


Слайд 54

Enough details ? here hy no date t w re is explicit the but it http://blog.thiga.fr/product-management/bdd-gherkin-pour-ecrire-vos-user-stories/ @aloyer


Слайд 55

Enough details ? sult would such re Wh y exist? http://blog.thiga.fr/product-management/bdd-gherkin-pour-ecrire-vos-user-stories/ @aloyer


Слайд 56

@aloyer


Слайд 57

# language: fr
 Fonctionnalité:
 
 
 
 
 
 
 
 
 @reseau_simplifié
 Scénario: Obtenir une feuille de l'itinéraire par d'arrivée
 2 Place de la Défense: 48.893195, 2.238945
 Etant donné que je veux aller de "48.893195, 2.238945" au "25 rue du Et que je veux partir à 9h30 avec les options suivantes:
 | X | Transport en commun |
 | X | Le plus rapide |
 | | Le moins de changement |
 Alors je devrais obtenir la feuille de route suivante:
 | Type | Heure | Localisation | Transport | | départ | 9h30 | 2 Place de la Défense | Pied | | | 9h37 | La Défense | RER A vers Vincennes | | | 9h47 | Châtelet - Les Halles | Pied | | arrivée | 9h54 | 25 rue du Louve | | Louvre, Paris"
 Durée ~5min 10min ~7min - | | | | | Distance 400m 550m - |
 |
 |
 |
 | @aloyer


Слайд 58

# language: fr
 Fonctionnalité:
 
 
 
 
 Scénario: Rer A dans le réseau de transport simplifié
 
 
 Etant donné le réseau de transport simplifié "Parisien"
 Alors le Rer A devrait passer toutes les 10mins à "la Défense" à partir de 5h37
 Alors les temps de transport cumulés depuis "la Défense" devraient être:
 | Charles de Gaulle Etoile | 5min |
 | Auber | 7min |
 | Chatelet les Halles | 10min |
 
 
 @reseau_simplifié
 Scénario: Obtenir une feuille de l'itinéraire par d'arrivée
 2 Place de la Défense: 48.893195, 2.238945
 Etant donné que je veux aller de "48.893195, 2.238945" au "25 rue du Et que je veux partir à 9h30 avec les options suivantes:
 | X | Transport en commun |
 | X | Le plus rapide |
 | | Le moins de changement |
 Alors je devrais obtenir la feuille de route suivante:
 | Type | Heure | Localisation | Transport | | départ | 9h30 | 2 Place de la Défense | Pied | | | 9h37 | La Défense | RER A vers Vincennes | | | 9h47 | Châtelet - Les Halles | Pied | | arrivée | 9h54 | 25 rue du Louve | | Louvre, Paris"
 Durée ~5min 10min ~7min - | | | | | Distance 400m 550m - |
 |
 |
 |
 | @aloyer


Слайд 59


 # language: fr
 Fonctionnalité:
 
 Scénario: Le métro 1 dans le réseau de transport simplifié
 
 Etant donné le réseau de transport simplifié "Parisien"
 Alors le métro 1 devrait passer dans chaque station toutes les 5mins à partir de 6h00
 
 Scénario: Rer A dans le réseau de transport simplifié
 
 
 Etant donné le réseau de transport simplifié "Parisien"
 Alors le Rer A devrait passer toutes les 10mins à "la Défense" à partir de 5h37
 Alors les temps de transport cumulés depuis "la Défense" devraient être:
 | Charles de Gaulle Etoile | 5min |
 | Auber | 7min |
 | Chatelet les Halles | 10min |
 
 
 @reseau_simplifié
 Scénario: Obtenir une feuille de l'itinéraire par d'arrivée
 2 Place de la Défense: 48.893195, 2.238945
 Etant donné que je veux aller de "48.893195, 2.238945" au "25 rue du Et que je veux partir à 9h30 avec les options suivantes:
 | X | Transport en commun |
 | X | Le plus rapide |
 | | Le moins de changement |
 Alors je devrais obtenir la feuille de route suivante:
 | Type | Heure | Localisation | Transport | | départ | 9h30 | 2 Place de la Défense | Pied | | | 9h37 | La Défense | RER A vers Vincennes | | | 9h47 | Châtelet - Les Halles | Pied | | arrivée | 9h54 | 25 rue du Louve | | ntinued… To be co Louvre, Paris"
 Durée ~5min 10min ~7min - | | | | | Distance 400m 550m - |
 |
 |
 |
 | @aloyer


Слайд 60

declarative imperative ugh not eno details too much details Adjust the cursor @aloyer


Слайд 61

declarative imperative ugh not eno details too much details Adjust the cursor Together! @aloyer


Слайд 62

Remove ambiguities but keep scenario short Am I concrete enough on the expected behavior? What if the scenario has more details? Signal vs noise ratio? Rely on Persona/Defaults… Do Scenario Review… @aloyer


Слайд 63

BDD is NOT About is About L a tool for test automation K communication L acceptance criteria K behavior " !


Слайд 64

Q Questions? Training Coaching /[TBD]DD/ Testing/Clean Code Arnauld LOYER — @aloyer Mastering Software Development


Слайд 65


×

HTML:





Ссылка: