Upload
imoneytech
View
89
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
Behaviour Driven Development (BDD)
What is BDD Behaviour Driven Development
Behaviours = Scenarios What is it supposed to do
Driven Development Well driving your development
process
Behat Documentation
ldquoItrsquos the idea that you start by writing human-readable sentences that describe a feature of
your application and how it should work and only then implement this behaviour in softwarerdquo
BDD StepsThink
Red Bar
Green Bar
Refactor
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
What is BDD Behaviour Driven Development
Behaviours = Scenarios What is it supposed to do
Driven Development Well driving your development
process
Behat Documentation
ldquoItrsquos the idea that you start by writing human-readable sentences that describe a feature of
your application and how it should work and only then implement this behaviour in softwarerdquo
BDD StepsThink
Red Bar
Green Bar
Refactor
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Behaviours = Scenarios What is it supposed to do
Driven Development Well driving your development
process
Behat Documentation
ldquoItrsquos the idea that you start by writing human-readable sentences that describe a feature of
your application and how it should work and only then implement this behaviour in softwarerdquo
BDD StepsThink
Red Bar
Green Bar
Refactor
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Driven Development Well driving your development
process
Behat Documentation
ldquoItrsquos the idea that you start by writing human-readable sentences that describe a feature of
your application and how it should work and only then implement this behaviour in softwarerdquo
BDD StepsThink
Red Bar
Green Bar
Refactor
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Behat Documentation
ldquoItrsquos the idea that you start by writing human-readable sentences that describe a feature of
your application and how it should work and only then implement this behaviour in softwarerdquo
BDD StepsThink
Red Bar
Green Bar
Refactor
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
BDD StepsThink
Red Bar
Green Bar
Refactor
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Test Framework Browser Driver
amp
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
ScenarioGiven [Context]And [More context]
When (I do) [Action]And [Other Action]
Then (I should see) [Outcome]And [More Outcomes]
Itrsquos called Gherkin
btw
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Given
bull Will almost always be the URL of the page to test Given ^(|I )am on (|the )homepage$ Given ^(|I )am on (Pltpagegt[^]+)$
bull ExampleGiven I am on ldquocredit-cardrdquo
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Whenbull Any user action - press a button fill a the textbox
select a select box When ^(|I )go to (Pltpagegt[^]+)$ When ^(|I )reload the page$ When ^(|I )move backward one page$ When ^(|I )move forward one page$ When ^(|I )press (Pltbuttongt([^]|))$ When ^(|I )follow (Pltlinkgt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with (Pltvaluegt([^]|))$ When ^(|I )fill in (Pltfieldgt([^]|)) with$ When ^(|I )fill in (Pltvaluegt([^]|)) for (Pltfieldgt([^]|))$ When ^(|I )fill in the following$ When ^(|I )select (Pltoptiongt([^]|)) from (Pltselectgt([^]|))$ When ^(|I )check (Pltoptiongt([^]|))$ When ^(|I )uncheck (Pltoptiongt([^]|))$ When ^(|I )attach the file (P[^]) to ldquo(Pltfieldgt([^]|))$
bull Example When I press ldquoMore Infordquo
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Thenbull What should be seen happen on the page Then ^(|I )should be on (Pltpagegt[^]+)$ Then ^(|I )should be on (|the )homepage$ Then ^the response status code should be (Pltcodegtd+)$ Then ^the response status code should not be (Pltcodegtd+)$ Then ^(|I )should see (Plttextgt([^]|))$ Then ^(|I )should not see (Plttextgt([^]|))$ Then ^(|I )should see text matching (Pltpatterngt([^]|))$ Then ^(|I )should not see text matching (Pltpatterngt([^]|))$ Then ^the response should contain (Plttextgt([^]|))$ Then ^the response should not contain (Plttextgt([^]|))$ Then ^(|I )should see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^(|I )should not see (Plttextgt([^]|)) in the (Pltelementgt[^]) element$ Then ^the (Pltelementgt[^]) element should contain (Pltvaluegt([^]|))$ Then ^the (Pltelementgt[^]) element should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see an (Pltelementgt[^]) element$ Then ^(|I )should not see an (Pltelementgt[^]) element$ Then ^the (Pltfieldgt([^]|)) field should contain (Pltvaluegt([^]|))$ Then ^the (Pltfieldgt([^]|)) field should not contain (Pltvaluegt([^]|))$ Then ^(|I )should see (Pltnumgtd+) (Pltelementgt[^]) elements$ Then ^print current URL$ Then ^print last response$
bull ExampleThen I should be on ldquoMaybank Gold Card 2rdquo
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
What to test
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Scenario
Given I am on ldquocredit-cardrdquo
When I hover on ldquorating-iconrdquo
Then I should see ldquo3 cashbackrdquo
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
ScenarioGiven I am on ldquocredit-cardrdquoWhen I check ldquopetrol-filterrdquoAnd I press ldquoFilterrdquoThen I should see [Petrol] cardAnd I should not see [Groceries] cardAnd I should not see [Travel] cardAnd I should not see [Shopping] cardAnd I should not see [Bills] card
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Output
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green
Recap
bull Think about the behaviours you want
bull Write scenarios that describe those behaviours
bull Start a failing test
bull Write code for it to pass
bull Restart test = green