26
INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with Clara Benac, Henrique Ferreiro, Macías López, Miguel Ángel Francisco Laura M. Castro Universidade da Coruña October 19 th 2015 Sophia-Antipolis (France)

INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

INTUITEST 2015

Using property-based testing to automate test case generation and diagnosis in web-based

graphical user interfaces

joint work with Clara Benac, Henrique Ferreiro, Macías López, Miguel Ángel Francisco

Laura M. CastroUniversidade da Coruña

October 19th 2015Sophia-Antipolis (France)

Page 2: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

2

Motivation

● We wish we could auto-magically test at the GUI level, don't we?

Page 3: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

3

Motivation

● We wish we could auto-magically test at the GUI level, don't we?– It would be like having our users test our

product, only without them being the ones facing crashes and other undesired behaviour

Page 4: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

4

Motivation

● We wish we could auto-magically test at the GUI level, don't we?– Hiring human alpha/beta-testers is… tricky

● Expensive● Difficult to communicate● Difficult to reproduce● Not exhaustive

Page 5: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

5

Motivation

● We wish we could auto-magically test at the GUI level, don't we?– Automated monkey testing is… tricky too

● Cheap, but inefficient● Difficult to debug● Not exhaustive

Page 6: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

6

Motivation

● We wish we could auto-magically test at the GUI level, don't we?– Automated testing is… challenging

● Models are difficult to write● Complete models are unfeasible

Page 7: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

7

Motivation

● What if we “smarted-up” monkey testing with property-based testing…– … so that testing would be automated,

cheaper, easier to reproduce, more exhaustive, more effective, easier to model?

Page 8: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

8

The idea

● To test at the GUI level, we want to...– interact in a random manner, performing any

action available to the user

– interact in a series of pattern-steps, when specific interaction-patterns are present

● … let's combine the two!

Page 9: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

9

The idea

● To test at the GUI level, we want to...– interact in a random manner, performing any

action available to the user

– interact in a series of pattern-steps, when specific interaction-patterns are present

● … let's combine the two! black-boxsystem-level

validation

Page 10: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

10

The idea

● To test at the GUI level, we want to...– interact in a random manner, performing any

action available to the user

– interact in a series of pattern-steps, when specific interaction-patterns are present

● … let's combine the two! black-boxsystem-level

validationweb-based

Page 11: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

11

The idea

● To test at the GUI level, we want to...– interact in a random manner, performing any

action available to the user

– interact in a series of pattern-steps, when specific interaction-patterns are present

● … let's combine the two! black-boxsystem-level

validationweb-basedi.e.

follow linkclick buttoninput text

Page 12: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

12

The idea

● The random aspect– is easy to model, to automate

– introduces variability into tests that escapes preconceptions and assumptions

● The specific interactions– are easier to model, since they focus on a

specific task or subset of functionality

– allow for more exhaustive testing

Page 13: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

13

Theidea

:WebUImodel :WebUIactions:SUTmodel :UIframework

run()

run()

setup()

teardown()

get_actions()get_links()

activate_element()click_element()

:WebdrvSession

setup()

test generation

test execution

teardown()

end test execution

Page 14: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

14

Theidea

:WebUImodel :WebUIactions:SUTmodel :UIframework

run()

run()

setup()

teardown()

get_actions()get_links()

activate_element()click_element()

:WebdrvSession

setup()

test generation

test execution

teardown()

end test execution

the randomaspect: whatever

we find onthe GUI

Page 15: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

15

Theidea

:WebUImodel :WebUIactions:SUTmodel :UIframework

run()

run()

setup()

teardown()

get_actions()get_links()

activate_element()click_element()

:WebdrvSession

setup()

test generation

test execution

teardown()

end test execution

the specificinteractions:hand over to

specific model

Page 16: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

16

Theidea

:WebUImodel :WebUIactions:SUTmodel :UIframework

run()

run()

setup()

teardown()

get_actions()get_links()

activate_element()click_element()

:WebdrvSession

setup()

test generation

test execution

teardown()

end test execution

the specificinteractions:hand over to

specific model

QuickCheckstateful models

Page 17: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

17

The implementation

WebUImodel

+run()+setup()+teardown()-prop_webui(m : webUI_model)-setup(m : webUI_model)-teardown(m : webUI_model)#run(m : webUI_model)

call setup(m)run quick-check testscall teardown(m)

SUTmodel

+run()+setup()+teardown()

super.run(this)

start webdriver sessioncall m.setup()

call m.teardown()stop webdriver session

call prop_webui(m)

set base URL for webdriver session

WebdrvSession

«uses»

WebUIactions

+common_actions()+specific_actions()

strategy

UIframework

+specific_actions()

EQC dynamic cluster

Erlang behaviours

Page 18: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

18

The validation

VoDKATV pilot study

Page 19: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

19

The validation

VoDKATV pilot study

Page 20: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

20

The validation

● VoDKATV pilot study– Web-based GUI for configuration and

administration● 36% of the GUI involves form-like interactions● 48% of the GUI involves table-like interactions

Page 21: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

21

The validation

● VoDKATV pilot study– Web-based GUI for configuration and

administration● 36% of the GUI involves form-like interactions● 48% of the GUI involves table-like interactions

easy-to-writereusable models

Page 22: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

22

The validation

● VoDKATV pilot study– Form-like interaction

Page 23: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

23

The validation

● VoDKATV pilot study– Table-like interaction

Page 24: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

24

The validation

● VoDKATV pilot study– Traditional GUI-level is manual, ~1h per

functionality/iteration, poor regression testing, no negative testing

– Three bugs in the last 8 months vs. three bugs in one week of testing with new method & tool

– Test model reuse (migration to new admin GUI)

– Cheaper, unattended, easy to reproduce

Page 25: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

25

Wrap-up

● We have designed a new approach to GUI-level testing– PBT-based, enables automated test case generation,

execution and diagnosis– allows for test-effort reuse and liberates from test-case design

● We have implemented it into a testing framework– combines a model for random browsing with stateful PBT

models for common interaction scenarios

● We have validated it in an industrial system– we found several bugs that have slipped into production after

more traditional testing

Page 26: INTUITEST 2015 - cdn0.scrvt.com · INTUITEST 2015 Using property-based testing to automate test case generation and diagnosis in web-based graphical user interfaces joint work with

26

Wrap-up

Framework available at– https://github.com/prowessproject/webui-test

Thanks for your attention!

Questions?