![Page 1: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/1.jpg)
Acceptance Test StylesImperative vs Declarative
Leeds Tester Gathering – April 2013
Alan Parkinson
![Page 2: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/2.jpg)
![Page 3: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/3.jpg)
![Page 4: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/4.jpg)
Given a user “alan" exists with password
"secret"
And I am not logged in
When I navigate to the home page
Then I am redirected to the login form
When I enter the “username” with “alan”
And I enter the “password” with “secret”
And I press “login”
Then I am redirected to the home page
![Page 5: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/5.jpg)
Given I am an unauthenticated User
When I attempt to view some restricted content
Then I am asked to authenticate
When I authenticate with valid credentials
Then I am shown the restricted content
![Page 6: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/6.jpg)
Summary
• Write in the Declarative style – Your scenario doesn’t become brittle– The business will read it
• Avoid unnecessary detail– Don’t tie your scenario to the UI– Using sensible default values – Override the defaults where required
![Page 7: Acceptance test styles - Imperative vs Declarative](https://reader036.vdocuments.us/reader036/viewer/2022062312/55583989d8b42ac6078b4a8d/html5/thumbnails/7.jpg)
Questions and Answers
@alan_parkinson @TeamHindsight
Alan ParkinsonCEO and Co-founder Hindsight Software Ltd