geoff & emily bache - specification by example with gui tests-how could that work - eurostar...

34
Emily Bache, Bache Consulting & Pagero GeoBache, Jeppesen Specification by Example with GUI tests - How could that work? @esconfs #esconfs

Upload: eurostar-software-testing-conference

Post on 23-Jun-2015

115 views

Category:

Technology


0 download

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

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
Page 3: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

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

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

5

Page 6: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

Specification by Example

6

Page 7: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

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

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

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

GUI testing with Record - Replay

10

Page 11: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

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

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

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

GUI testing with Cucumber, Fitnesse etc

14

Page 15: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

Using Cucumber

Feature

System Under Test (SUT)

Step Definitions

http://cukes.info

Page 16: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

Using Fitnesse

16

http://fitnesse.org

Page 17: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

“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

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

19

Page 20: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

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

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

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

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

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

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

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

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

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

29

Page 30: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

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

Crew Management System

31

Page 32: Geoff & Emily Bache - Specification By Example With GUI Tests-How Could That Work - EuroSTAR 2013

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

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

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