geoff & emily bache - specification by example with gui tests-how could that work - eurostar...
DESCRIPTION
EuroSTAR Software Testing Conference 2013 presentation on Specification By Example With GUI Tests-How Could That Work by Geoff & Emily Bache. See more at: http://conference.eurostarsoftwaretesting.com/past-presentations/TRANSCRIPT
![Page 1: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/1.jpg)
Emily Bache, Bache Consulting & PageroGeoff Bache, Jeppesen
Specification by Example with GUI tests - How could that work?
@esconfs#esconfs
![Page 2: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/2.jpg)
![Page 3: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/3.jpg)
Specification by Example with Rich-Client application?
3
![Page 4: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/4.jpg)
Jeppesen
Agile transition underway next-generation Crew Management System
4
![Page 5: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/5.jpg)
5
![Page 6: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/6.jpg)
Specification by Example
6
![Page 7: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/7.jpg)
Specification by Example
Gojko Adzic’s book Collaborative workshops Define Example Scenarios BEFORE
build code
7
![Page 8: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/8.jpg)
Agile Requirements
User Story Conversation+ Examples+
From “Agile Testing” by Crispin, Gregory
Requirement=
8
aka Scenarios
![Page 9: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/9.jpg)
Scenario -> Regression test
BEFORE code is written, it’s a requirement specification
AFTER code is written it’s a regression test
Important to preserve the language & format
9
Living Documentation
![Page 10: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/10.jpg)
GUI testing with Record - Replay
10
![Page 11: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/11.jpg)
Recorded GUI Tests
Click around the GUI like a user would
Record a script Re-play the script to regression
test
11
Assumes the GUI is already built
![Page 12: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/12.jpg)
Recorded Scripts
Easy to create, hard to maintain
12
![Page 13: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/13.jpg)
Page Object Pattern
13
Test Case Scripts
System Under Test
Page Objects
Hand Coded
Hand Coded
![Page 14: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/14.jpg)
GUI testing with Cucumber, Fitnesse etc
14
![Page 15: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/15.jpg)
Using Cucumber
Feature
System Under Test (SUT)
Step Definitions
http://cukes.info
![Page 17: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/17.jpg)
“Domain Language” Tests
Domain LanguageScenario or Table
System Under Test
Test Fixture “Glue Code”“Step Definitions”
17
Hand Coded
Hand Coded
![Page 18: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/18.jpg)
Bypass GUI?
Domain LanguageScenario
Test Fixture GUI
Bypass GUI, test core system directly
18
Under-the-GUI API
![Page 19: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/19.jpg)
19
![Page 20: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/20.jpg)
Demo: building a new feature
with StoryText
20
![Page 21: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/21.jpg)
Open Source Development paid for by Jeppesen supports Java Swing, Eclipse RCP, PyGTK, Tkinter, wxPython
http://texttest.org
21
![Page 22: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/22.jpg)
TextTest tests have two parts
Use Case GUI Log
List of user actions:Domain language
Recorded text:Contents of GUI
22
![Page 23: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/23.jpg)
TextTest - test fixtures
Create “use case” part of text by Record session in UI Name your actions: snippets of domain language UI Map - domain language mapped to actions
23
![Page 24: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/24.jpg)
Compose a Domain Language
24
Group several user actions and name them Match the language of the specification workshop Re-usable terms for many tests
![Page 25: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/25.jpg)
Record the Test Fixture/Step definitions
Use Case(one per test)
“UI Map” + “shortcuts”(shared by whole suite)
System Under Test
25
Recorded
Configured
![Page 26: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/26.jpg)
StoryText tests
Use Case GUI Log
List of user actions:Domain language
Recorded text:Contents of GUI
26
![Page 27: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/27.jpg)
The GUI log
“Assert” part of the test Auto-generated by
StoryText ASCII art represents UI
state
27
![Page 28: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/28.jpg)
StoryText tests
Use Case GUI Log
Plain Text: search, store, manipulate, diff, version...
28
![Page 29: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/29.jpg)
29
![Page 30: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/30.jpg)
Sample Use-Case : Undo Service Type changes
30
open default plan and show rosterschange service type of activity JPO 2537 for Brogan to Mundowait for completion of undoclose and discard changes
![Page 31: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/31.jpg)
Crew Management System
31
![Page 32: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/32.jpg)
Assert Everything by default
Log of absolutely everything that changes in the GUI Each test defines filters to focus on interesting parts Often catch errors the test wasn’t designed to find
32
![Page 33: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/33.jpg)
Limitations of the approach
Only supports certain GUI libraries Maintainability of tests depends on good test design◦ filter GUI log carefully
33
![Page 34: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013](https://reader033.vdocuments.mx/reader033/viewer/2022060118/55893231d8b42ad7138b45af/html5/thumbnails/34.jpg)
Conclusions
Specification by Example - automating Domain Language scenarios needs fixture code
◦TextTest “records” the fixtures
GUI intensive applications - need to check carefully what’s on the screen
◦TextTest takes “screen shots” as ASCII art
34