52
Model-Based Testing – From theory to practice Frédéric Dadeau – Elizabeta Fourneret – Bruno Legeard Ecole des jeunes chercheurs en programmation – Nancy – 24 june 2015

Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

Model-Based Testing – From theory to practice

Frédéric Dadeau – Elizabeta Fourneret – Bruno Legeard

Ecole des jeunes chercheurs en programmation – Nancy – 24 june 2015

Page 2: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

2

Presentation of the workshop

Morning - Presentations • Part I – Introduction to MBT • Part II – MBT with Smartesting CertifyIt • Part III – PKCS#11 case study

Afternoon – Practical session

• Discovering ATM case study • Practicing CertifyIt

Page 3: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

Model-Based Testing – From theory to practice

Part I – Introduction to MBT

Bruno Legeard

Ecole des jeunes chercheurs en programmation – Nancy – 24 june 2015

Page 4: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

4

400 000 certified testers

Page 5: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

5

Various faces of MBT

Tests

Page 6: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

6

Various faces of MBT

Model-Based Testing : « Testing based on or involving models. » ISTQB Glossary - 2015

Page 7: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

7

Outline

1. Introduction to MBT

a. Motivations and usage

b. Process and roles

2. A taxonomy of MBT approaches

3. Application domains

4. Conclusion

Page 8: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

8

Motivations

Source : Model-Based Testing, Where do we stand? – CACM – 2/15, Binder, Legeard, Kramer

Source: MBT User Survey 2014

Page 9: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

9

Motivations

“Test Models provide us more flexibility in the creation of automated test scripts by using different test case generation strategies according to the current needs (different robustness test, tests for changed or critical requirements, etc.)” “Executable model paradigm should enable us to create self-testing mechanisms.” “MBT helps us to improve change request process” “MBT supports test automation” “MBT is capable to also validate the test basis” “Massive increase of reuse” “Improved coverage of requirement readability of coverage” “Increased productivity and improved product reliability (new type of bugs, Increased test coverage)”

Page 10: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

10

Test levels

Source: MBT User Survey 2014

Page 11: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

11

Test types

Source: MBT User Survey 2014

Page 12: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

12

Modeling practices

Do you use models in other development phases, for example for requirement elicitation or system design?

Yes No

58,9%

41,1%

Source: MBT User Survey 2014

Page 13: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

13

Modeling practices - 2

0,0%

10,0%

20,0%

30,0%

40,0%

50,0%

60,0%

70,0%

80,0%

Use Casediagrams

Activitydiagrams

Statemachines

Sequencecharts

BusinessProcessmodels

DomainSpecific

Languagemodels

What type of models do you use in those other development phases?

Source: MBT User Survey 2014

Page 14: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

14

Outline

1. Introduction to MBT

a. Motivations and usage

b. Process and roles

2. A taxonomy of MBT approaches

3. Application domains

4. Conclusion

Page 15: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

15

MBT process - 1

Source : Mark Utting, Alexander Pretschner, and Bruno Legeard. 2012. A taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 22, 5 (August 2012), 297-312.

Page 16: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

16

MBT Process - 2

Page 17: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

17

MBT Process - 3

Page 18: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

18

MBT roles

Page 19: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

19

MBT modeling

MBT modeling is strongly related to test objectives. MBT models should be:

– Abstract enough • Covering what is intended to be tested

– Detailled and precise enough • Enables to compute the expected results (Oracle)

Test verdict assignement

– Validated and verified • If the test « fails », what is wrong? The MBT model or the System

under Test (SUT)?

MBT is back-to-back testing – MBT model vs SUT

Page 20: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

20

Outline

1. Introduction to MBT

a. Motivations and usage

b. Process and roles

2. A taxonomy of MBT approaches

3. Application domains

4. Conclusion

Page 21: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

21

A taxonomy of MBT approaches

Source : Mark Utting, Alexander Pretschner, and Bruno Legeard. 2012. A taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 22, 5 (August 2012), 297-312.

Page 22: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

22

Subjet and focus of the MBT model

Subjet • System • Environment • Tests

Focus

• Structure • Behavior

An MBT model generally combines these various subject and focus aspects

Page 23: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

23

MBT model - Example

Page 24: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

24

MBT model - Example

Page 25: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

25

Subject of the MBT model

Source : Mark Utting, Alexander Pretschner, and Bruno Legeard. 2012. A taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 22, 5 (August 2012), 297-312.

Page 26: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

26

Subject of the MBT model

05

101520253035404550

The modeldescribes how the

system works.

The modeldescribes the

system'senvironment,

concentrating oninterfaces and

stimuli (e.g. from auser's point of view).

The modeldescribes the testprocedure ratherthan the system

itself.

What is the subject of your model?

The one and onlysubject of the model

Important subject of themodel

Not the major subject ofthe model

Not at all a subject ofthe model

Source: MBT User Survey 2014

Page 27: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

27

Focus of the MBT model

What aspect does your MBT model focus on?

Structural aspect

Behavioral aspect

Both

59%

35%

6%

Source: MBT User Survey 2014

Page 28: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

28

Modeling paradigms for MBT • Many modeling paradigms used for MBT:

– Behavioral modeling (not exhaustive) • Flow Charts / BPMN / UML activity diagram

• Data Flow Diagrams

• Finite state machine – Statecharts – UML state machines

• Pre-post conditions / OCL

• Markov chain

• Event Sequence Graph

• Domain specific languages

– Structural modeling (Point of control & observation) • UML calss diagram

• Block diagram

• Representation : – Graphical (more « intuitive » )

– Textual / formal (more precise)

Page 29: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

29

MBT modeling - BPMN

Page 30: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

30

MBT modeling – OCL-based

Page 31: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

31

Event Sequence Graph

Page 32: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

32

Reuse of existing design models

Can we re-use design models for MBT?

In principle Yes, but: • The reused model is it at the right abstraction level to adress my test

objectives? • Is it complete enougch to adress my test objectives? • Does my MBT tool manage such model?

Page 33: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

33

Reuse of existing design model

0,0%

5,0%

10,0%

15,0%

20,0%

25,0%

30,0%

35,0%

Completelyidentical

Slightly modified Largely modified Completelydifferent

Source: MBT User Survey 2014

If you use models both for analysis or design and for testing activities, how different are these models?

Page 34: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

34

Reuse of models - Example

Business Process

Business

scenario

Test analyst

Business analyst

Page 35: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

35

Taxonomy of MBT approaches

Page 36: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

36

Generation of the test repository

Business

Requirements

Tests

Fonctionnels

Test

repository

manual auto

Tests ready for execution

and, or

Modelling for test generation

Page 37: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

37

MBT generated artifacts

0,0%

10,0%

20,0%

30,0%

40,0%

50,0%

60,0%

70,0%

80,0%

90,0%

Test cases (formanual testexecution)

Test scripts (forautomated test

execution)

Test data Other artifacts(documentation,

test suites,...)

What artifacts do you generate from the model?

Source: MBT User Survey 2014

Page 38: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

38

Traceability matrix

Page 39: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

39

Test selection criteria

Page 40: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

40

Test selection criteria

Source : ISTQB – Certification Model-Based Testing

Page 41: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

41

Test selection criteria

0,0%

10,0%

20,0%

30,0%

40,0%

50,0%

60,0%

70,0%

80,0%R

eq

uir

em

en

tsco

ve

rag

e

Str

uctu

ral

mo

de

lco

ve

rag

e i)

Da

ta c

ove

rag

eii)

Ra

nd

om

&sto

ch

astic

Sce

na

rio

- /

pa

tte

rn-b

ase

diii

)

Pro

ject-

dri

ve

niv

)

What selection criteria do you apply to limit the number of generated tests?

Source: MBT User Survey 2014

Page 42: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

42

Coverage monitoring

0,0%

10,0%

20,0%

30,0%

40,0%

50,0%

60,0%

70,0%

What kind of coverage is measured for your test runs?

Source: MBT User Survey 2014

Page 43: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

43

Taxonomy of MBT approaches

Page 44: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

44

MBT test execution

• Manual test execution • Offline MBT • Online MBT

Offline MBT “Model-based testing approach whereby test cases are generated into a repository for future execution.”

Online MBT “Model-based testing approach whereby test cases are generated and executed simultaneously.”

ISTQB Glossary - 2015

Page 45: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

45

MBT test execution

0,0%

10,0%

20,0%

30,0%

40,0%

50,0%

60,0%

70,0%

80,0%

manually automatically off-line (firstgenerated, then executed)

automatically on-the-fly(generated and executed in

one step)

How are the tests executed?

Source: MBT User Survey 2014

Page 46: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

46

Outline

1. Introduction to MBT

a. Motivations and usage

b. Process and roles

2. A taxonomy of MBT approaches

3. Application domains

4. Conclusion

Page 47: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

47

Application domains

Enterprise IT (including packaged applications); 30,0%

Embedded controller (real-time); 27,1%

Embedded software (not real-time);

11,4%

Software Infrastructure;

5,7%

Web application; 18,6%

Gaming; 2,9%

Communications; 4,3%

What is the general application domain of the system under test?

Page 48: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

48

Satisfaction level of MBT users

0,0% 10,0% 20,0% 30,0% 40,0% 50,0%

extremely uneffective

moderately uneffective

slightly uneffective

no effect

slightly effective

moderately effective

extremely effective

Overall, how effective do you think MBT has been?

Source: MBT User Survey 2014

Page 49: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

49

Outline

1. Introduction to MBT

a. Motivations and usage

b. Process and roles

2. A taxonomy of MBT approaches

3. Application domains

4. Conclusion of Part I

Page 50: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

50

An emerging technology in industry

Source : Harald Altinger, Franz Wotawa, and Markus Schurius. 2014. Testing methods used in the automotive industry: results from a survey. In Proceedings of the 2014 Workshop on Joining AcadeMiA and Industry Contributions to Test Automation and Model-Based Testing (JAMAICA 2014). ACM, New York, NY, USA, 1-6.

Re – Research PD – Pre Development SD – Serie Development TE - TEsting related department

Page 51: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

51

UCAAT 2015

Page 52: Model-Based Testing From theory to practicemembers.femto-st.fr/sites/femto-st.fr.frederic-dadeau/files/content/... · Model-Based Testing – From theory to practice Frédéric Dadeau

Source - http://model-based-testing.info

52

Thanks for your attention

Questions on Part I?