+ All Categories
Home > Documents > Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain...

Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain...

Date post: 27-Jul-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
34
Emily Bache, Bache Consulting & Pagero GeoBache, Jeppesen Specification by Example with GUI tests - How could that work? @esconfs #esconfs
Transcript
Page 1: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Emily Bache, Bache Consulting & PageroGeoff Bache, Jeppesen

Specification by Example with GUI tests - How could that work?

@esconfs#esconfs

Page 2: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI
Page 3: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Specification by Example with Rich-Client application?

3

Page 4: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Jeppesen

Agile transition underway next-generation Crew Management System

4

Page 5: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

5

Page 6: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Specification by Example

6

Page 7: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Specification by Example

Gojko Adzic’s book Collaborative workshops Define Example Scenarios BEFORE

build code

7

Page 8: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Agile Requirements

User Story Conversation+ Examples+

From “Agile Testing” by Crispin, Gregory

Requirement=

8

aka Scenarios

Page 9: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

GUI testing with Record - Replay

10

Page 11: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Recorded Scripts

Easy to create, hard to maintain

12

Page 13: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Page Object Pattern

13

Test Case Scripts

System Under Test

Page Objects

Hand Coded

Hand Coded

Page 14: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

GUI testing with Cucumber, Fitnesse etc

14

Page 15: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Using Cucumber

Feature

System Under Test (SUT)

Step Definitions

http://cukes.info

Page 16: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Using Fitnesse

16

http://fitnesse.org

Page 17: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

“Domain Language” Tests

Domain LanguageScenario or Table

System Under Test

Test Fixture “Glue Code”“Step Definitions”

17

Hand Coded

Hand Coded

Page 18: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Bypass GUI?

Domain LanguageScenario

Test Fixture GUI

Bypass GUI, test core system directly

18

Under-the-GUI API

Page 19: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

19

Page 20: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Demo: building a new feature

with StoryText

20

Page 21: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Open Source Development paid for by Jeppesen supports Java Swing, Eclipse RCP, PyGTK, Tkinter, wxPython

http://texttest.org

21

Page 22: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

TextTest tests have two parts

Use Case GUI Log

List of user actions:Domain language

Recorded text:Contents of GUI

22

Page 23: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

StoryText tests

Use Case GUI Log

List of user actions:Domain language

Recorded text:Contents of GUI

26

Page 27: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

The GUI log

“Assert” part of the test Auto-generated by

StoryText ASCII art represents UI

state

27

Page 28: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

StoryText tests

Use Case GUI Log

Plain Text: search, store, manipulate, diff, version...

28

Page 29: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

29

Page 30: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Crew Management System

31

Page 32: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

Limitations of the approach

Only supports certain GUI libraries Maintainability of tests depends on good test design◦ filter GUI log carefully

33

Page 34: Specification by Example with GUI tests - How …...Hand Coded Hand Coded Bypass GUI? Domain Language Scenario Test Fixture GUI Bypass GUI, test core system directly 18 Under-the-GUI

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


Recommended