34
INDIVIDUELLE SOFTWARE INDIVIDUELLE SOFTWARE WILL YOUR TESTS STAND THE TEST OF TIME? PATTERNS FOR AUTOMATED UI TESTS ALEX SCHLADEBECK @ALEX_SCHL

WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

INDIVIDUELLE SOFTWAREINDIVIDUELLE SOFTWARE

WILL YOUR TESTS STAND THE TEST OF TIME?PATTERNS FOR AUTOMATED UI TESTS

ALEX SCHLADEBECK @ALEX_SCHL

Page 2: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

INTRODUCTIONS

• I am…– A tester, head of testing, a product owner– A geek

• Bredex is– A software development company– With a strong focus on quality

• Own open source tool• Multi-tool strategy• Agile testing• Scalable test automation

Training

Development

Testing

Page 3: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

INTRODUCTIONS

• I am…– A tester, head of testing, a product owner– A geek

• Bredex is … hiring – A software development company– With a strong focus on quality

• Own open source tool• Multi-tool strategy• Agile testing• Scalable test automation

Training

Development

Testing

Page 4: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

TODAY‘S JOURNEY

• The bad reputation of UI testing– Reasons and explanations

• Test structure for scalable UI tests• Examples

Page 5: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

<rant>

Page 6: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

Everyone hates UI tests

Page 7: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

Slow feedbackMore infrastructure

They‘re the top ofthe pyramid!

They‘re flaky

Small changeslead to big work

Page 8: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

Slow feedbackMore infrastructure

They‘re the top ofthe pyramid!

They‘re flaky

Small changeslead to big work

Different level offeedback – for thingsthat we can wait for

Yes

Sometimes yes, often because of

bad design orwrong usageThey‘re still in the

pyramid.User focus is

valid.And….context!

1. Same fordevelopment

2. Only if youdesign them

badly

Page 9: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

TO BOIL IT DOWN TO TWO POINTS…

• UI tests are often used to test things that shouldn‘t betested via the UI

• And they are often written badly. Very badly…

Page 10: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

Just because they’re maybe a bit more difficult – and not the favourite domain of developers –doesn’t mean that they are not potentially valid

</rant>

Page 11: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

UI TESTING TOOLS ONLY THINK OF ONE THING…

Technically addressing UI components in an application

They give no structural support fortest design

In fact, they help you to make a mess often…

Page 12: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

“Don‘t use capture-replay. ‘Tis the devil‘s work“

- Alex Schladebeck, repeatedly from ~2006 AD

Page 13: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

WHAT USUALLY HAPPENS

Tool-API

Test Case

check

click

input

Direct tool API callsto create workflow

Missing technical and logicallayers

- Redundancies- Unreadable- Not conducive to team work

Page 14: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

THERE ARE WAYS OF AVOIDING THIS…

In software engineering, a software design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.

It is not a finished design that can be transformed directly into source or machine code.

Page 15: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

HOW TESTS SHOULD BE STRUCTURED

Tool-API

Test Case

Technical Keywords

Functional atomic actions

Functional workflows

Page 16: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

HOW TESTS SHOULD BE STRUCTURED

Tool-API

Test Case

Technical Keywords

Functional atomic actions

Functional workflowsMay be split intointernals (private) and services (public)

Page 17: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

HOW TESTS SHOULD BE STRUCTURED

Tool-API

Test Case

Technical Keywords

Functional atomic actions

Functional workflowsFunctionaltester

Technical Tester / dev

Test managerCustomer

Page 18: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

EXAMPLE: GOOD LAYERING

Technical keyword

Functional atomicaction

Functional workflow

Test Case

Replace text [TEXT]

- Click

- Select all

- Send keys

Enter customer name [NAME]

- Replace text [TEXT]

Fill out customer form [CUSTOMER_KEY]

- Enter customer name [NAME]

- Enter customer street address [ADDRESS]

- Enter postcode [POSTCODE]

TC CUS 001: Create new customer

- Check customer does not exist [CUSTOMER_KEY]

- Create new customer [CUSTOMER_KEY]

- Check customer exists [CUSTOMER_KEY]

Functional workflowCreate new customer [CUSTOMER_KEY]

- Open new customer dialog

- Fill out customer form [CUSTOMER_KEY]

- Click Save

Page 19: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

EXAMPLE: SPLITTING INTO CONTEXTS

Tool-API

Test Case

Technical Keywords

Actions

Workflows

Actions

Workflows

Actions

Workflows

Context 1 Context 2 Context 3

Context: functionallyconnected applicationarea, e.g. Master Data

Page 20: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

YOU MAY KNOW SIMILAR APPROACHES

• Page Object Pattern– Services and Implementation separatedmore layers– Focus on page focus on functional context– Assertions checks– Strong user focus

• Gojko‘s 3 layers more layers

https://github.com/SeleniumHQ/selenium/wiki/PageObjectshttps://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/

Page 21: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

BAD EXAMPLE 1

• No abstraction levels• Redundant object location• Technical operations at highest level• Hard coded data

Page 22: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

REAL LIFE BAD EXAMPLE 1

Page 23: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

LAYERING EXAMPLES

Page 24: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

LAYERING EXAMPLES

• Clear levels• Data objects• VAV pattern

Page 25: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

A LOOK AT THE LOWER LAYERS

Page 26: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

A LOOK AT THE LOWER LAYERS

Page 27: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

DIFFERENT TOOLS AND DIFFERENT APIS

Page 28: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

MORE PATTERNS: VAV

• Verify – Act – Verify – Because otherwise you just don’t know

Page 29: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

MORE PATTERNS: DATA OBJECTS

• One row per required data set• Key and column are encapsulated in actions

Page 30: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

MORE PATTERNS: FORM PATTERN

• Fill in variable amounts of fields with one workflow

Page 31: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

THERE ARE MORE…

• Responsibility assignment• Fresh / shared setup• …

Page 32: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

POST-EXAMPLE DISCLAIMER

This works all the time like perfect unicorn rainbow poop! *

* In the contexts we have used these things in so far, they have been very useful to usand have saved us a lot of time and hair-pulling out.

Page 33: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

EXTRA DISCLAIMER

“These are patterns we know from software development!“- people

“Then train developers and testers to use themso that they write good UI tests”

- me

Page 34: WILL YOUR TESTS STAND THE TEST OF TIME?–A tester, head of testing, a product owner ... In software engineering, a software design pattern is a general reusable solution ... –And

THINGS TO TAKE AWAY

• You don’t have to hate your UI tests– You just have to do them right

• Don’t reinvent the wheel completely, but remember to expand and extend it– And re-evaluate for new contexts

• Use these patterns to get developers and testers of all flavours on board with UI automation