evolving mutation from objects to the cloud · •an illustration: aspect-oriented programming. 3...

114
1 Evolving mutation from objects to the cloud MUTATION workshop, Berlin, March 2011 Benoit Baudry

Upload: others

Post on 24-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1

Evolving mutation from objects to the cloud

MUTATION workshop, Berlin, March 2011

Benoit Baudry

Page 2: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2

Outline

•A perspective on testing in evolving software construction paradigms

•A methodological pattern: question-learn-test-feedback

•An illustration: aspect-oriented programming

Page 3: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

3

1.The scope of software testing

practice and research is broadening

Page 4: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

Page 5: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

purpose

Page 6: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression

Page 7: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

Page 8: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutationrequirements

Page 9: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutationrequirements

Page 10: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

requirements

Page 11: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

requirements

jobs

Page 12: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

requirements

jobs

dev-tester

integration

designer

engineer

QA architect

trainer

Page 13: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

tools

requirements

jobs

dev-tester

integration

designer

engineer

QA architect

trainer

Page 14: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

tools

requirements

jobs

dev-tester

integration

designer

engineer

QA architect

trainer

Page 15: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

4

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

tools

requirements

jobs

dev-tester

integration

designer

engineer

QA architect

trainer

Page 16: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

5

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

tools

requirements

jobs

dev-tester

integration

designer

engineer

QA architect

trainer

regression

Page 17: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

1.The scope of software testing

practice and research is widening

6

techniques

purpose

unit

integration

system

security

beta

performance

usabilityacceptance

regression target

statement

MC/DC

state

scenario environment

mutation

data generation

selection

prioritization

impact analysis

conformance

test plan

tools

requirements

jobs

dev-tester

integration

designer

engineer

QA architect

trainer

Page 18: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

7

2.because of (i) new ways of building

software systems to (ii) face the growing diversity of applications and requirements for software

systems

Page 19: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

Page 20: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Page 21: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

V-cycle

spiralCMMI

Page 22: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraintsV-cycle

spiralCMMI

Page 23: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

V-cycle

spiralCMMI critical

embeddeddistributed

security

scalability

Page 24: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

languages

V-cycle

spiralCMMI critical

embeddeddistributed

security

scalability

Page 25: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

languages

OOP AOP

CP UML

DSL

Procedural

CBSEDSML

V-cycle

spiralCMMI critical

end-user

embeddeddistributed

security

scalability

Page 26: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

economicslanguages

OOP AOP

CP UML

DSL

Procedural

CBSEDSML

V-cycle

spiralCMMI critical

end-user

embeddeddistributed

security

scalability

Page 27: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

economics

cloud

languages

OOP AOP

CP UML

DSL

Procedural

CBSEDSML

V-cycle

spiralCMMI critical

end-user

embeddeddistributed

security

scalability

innovation

outsourcing agility

lean

SOA

Page 28: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

economics

cloud

languages

OOP

environments

AOP

CP UML

DSL

Procedural

CBSEDSML

V-cycle

spiralCMMI critical

end-user

embeddeddistributed

security

scalability

innovation

outsourcing agility

lean

SOA

Page 29: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

economics

cloud

languages

OOP

environments

AOP

CP UML

DSL

Procedural

CBSEDSML

V-cycle

spiralCMMI critical

end-user

embeddeddistributed

security

scalability

innovation

outsourcing agility

lean

SOA

Page 30: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

2.because of (i) new ways of building

software systems to

8

processes

Innovation factory SCRUM

constraints

end-user

economics

cloud

languages

OOP

environments

AOP

CP UML

DSL

Procedural

CBSEDSML

V-cycle

spiralCMMI critical

end-user

embeddeddistributed

security

scalability

innovation

outsourcing agility

lean

SOA

Page 31: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 32: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 33: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 34: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 35: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 36: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 37: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

(ii) face the growing diversity of applications and requirements for

software systems

9

Page 38: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

10

3.The identification of core principles underlying this apparent seething landscape is a major challenge for research in software engineering.

Page 39: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

A visual representation

11

Carlo Ghezzi, Mehdi Jazayeri, and Dino Mandrioli. Fundamentals of Software Engineering, 2nd edition. 2002.

Page 40: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Key principles

•Rigor and formality•Separation of concerns•Modularity•Abstraction•Anticipation of change•Generality•Incrementality

12

Carlo Ghezzi, Mehdi Jazayeri, and Dino Mandrioli. Fundamentals of Software Engineering, 2nd edition. 2002.

Page 41: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Research in Software Engineering

13

Science

Maths Engineering

Peter J. Denning: Is computer science science?. Communications of the ACM, 2005. 48(4): p. 27 – 31.

Page 42: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Research in Software Engineering

13

Science

Maths Engineering

Peter J. Denning: Is computer science science?. Communications of the ACM, 2005. 48(4): p. 27 – 31.

Page 43: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Research in Software Engineering

13

Science

Maths Engineering

Peter J. Denning: Is computer science science?. Communications of the ACM, 2005. 48(4): p. 27 – 31.

Page 44: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

4.The confrontation of these core principles with the broadening scope of software leads to the emergence of new software

construction paradigms

14

Page 45: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Software construction paradigms

•Object-oriented programming

•Aspect-oriented programming

•Model-driven development

•Aspect-oriented modelling

•Multi-paradigm modelling

15

Page 46: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

16

Software testing research for emerging paradigms extends

beyond error detection to analyze and include the context imposed by these paradigms

Page 47: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Agility and Test Driven Development

17

Write unit test

Run test è fail

Write code

Run test

èpass

refactor

Page 48: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

MDD and MBT

18

Requirements

Design models

System

Test model

Test cases

Page 49: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

19

QLTF pattern

ack

tester SUTtest(t,j)

Learn

Test

Feedback

QuestionsSoftware construction paradigm

Page 50: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

20

Mutation in QLTF

what can go wrong?what type of errors are we looking for?what can mitigate/increase error risks?

ack

tester

SUTtest(t,j)

Learn

Test

FeedbackSoftware construction paradigm

Page 51: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

21

Mutation in QLTF

ack

tester

SUT

test(t,j)

what are the frequent faults?what usages trigger faults?what practices to detect faults?

Test

Feedback

Questions

Software construction paradigm

Page 52: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

ack

tester

SUTtest(t,j)

Feedback

Questions

Software construction paradigm

how can we assist fault detection?do our techniques detect faults?are new adequacy criteria adequate?

22

Mutation in QLTF

Page 53: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Learn

Questions

Software construction paradigm

ack

tester

SUT

test(t,j)Test

how can we prevent faults?how can testability be improved?how can test be integrated in dev. processes?

23

Mutation in QLTF

Page 54: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

24

Aspect oriented programming

Page 55: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

25

aspect DisplayUpdating { pointcut move(): call(void FigureElement.moveBy(int, int))|| call(void Line.setP1(Point)) || call(void Line.setP2(Point)) || call(void Point.setX(int)) || call(void Point.setY(int)); after(): move() { Display.update(); }}

class Point implements FigureElement { private int x = 0, y = 0; int getX() { return x; } int getY() { return y; } void setX(int x) { this.x = x; } void setY(int y) { this.y = y; } void moveBy(int dx, int dy) { ... }}

class Line implements FigureElement{ private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; } void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; } void moveBy(int dx, int dy) { ... }}

An example: AOP

Page 56: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

25

aspect DisplayUpdating { pointcut move(): call(void FigureElement.moveBy(int, int))|| call(void Line.setP1(Point)) || call(void Line.setP2(Point)) || call(void Point.setX(int)) || call(void Point.setY(int)); after(): move() { Display.update(); }}

class Point implements FigureElement { private int x = 0, y = 0; int getX() { return x; } int getY() { return y; } void setX(int x) { this.x = x; } void setY(int y) { this.y = y; } void moveBy(int dx, int dy) { ... }}

class Line implements FigureElement{ private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; } void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; } void moveBy(int dx, int dy) { ... }}

Advice

An example: AOP

Page 57: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

25

aspect DisplayUpdating { pointcut move(): call(void FigureElement.moveBy(int, int))|| call(void Line.setP1(Point)) || call(void Line.setP2(Point)) || call(void Point.setX(int)) || call(void Point.setY(int)); after(): move() { Display.update(); }}

class Point implements FigureElement { private int x = 0, y = 0; int getX() { return x; } int getY() { return y; } void setX(int x) { this.x = x; } void setY(int y) { this.y = y; } void moveBy(int dx, int dy) { ... }}

class Line implements FigureElement{ private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; } void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; } void moveBy(int dx, int dy) { ... }}

Pointcut descriptor (PCD)

Advice

An example: AOP

Page 58: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

25

aspect DisplayUpdating { pointcut move(): call(void FigureElement.moveBy(int, int))|| call(void Line.setP1(Point)) || call(void Line.setP2(Point)) || call(void Point.setX(int)) || call(void Point.setY(int)); after(): move() { Display.update(); }}

class Point implements FigureElement { private int x = 0, y = 0; int getX() { return x; } int getY() { return y; } void setX(int x) { this.x = x; } void setY(int y) { this.y = y; } void moveBy(int dx, int dy) { ... }}

class Line implements FigureElement{ private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; } void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; } void moveBy(int dx, int dy) { ... }}

Pointcut descriptor (PCD)

Advice

JoinPoint

An example: AOP

Page 59: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

25

aspect DisplayUpdating { pointcut move(): call(void FigureElement.moveBy(int, int))|| call(void Line.setP1(Point)) || call(void Line.setP2(Point)) || call(void Point.setX(int)) || call(void Point.setY(int)); after(): move() { Display.update(); }}

class Point implements FigureElement { private int x = 0, y = 0; int getX() { return x; } int getY() { return y; } void setX(int x) { this.x = x; } void setY(int y) { this.y = y; } void moveBy(int dx, int dy) { ... }}

class Line implements FigureElement{ private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; } void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; } void moveBy(int dx, int dy) { ... }}

Pointcut descriptor (PCD)

Advice

JoinPoint

An example: AOP

Page 60: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

26

+ login(String, String): boolean+ deleteAccount(int); boolean+ createAccount(): Account+ getAccount(int): Account

Bank

+ withdraw(int): boolean+ deposit(int): void

- balance: intAccount

accounts

*

public aspect AccessControl { pointcut controlledAccess():

execution(* Account.*(int));

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

• A fault in the PCD can have a ripple effect and result in many different faults

Page 61: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Withdraw

27

Page 62: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Faults in PCD

28

IntendedMatched

Page 63: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Faults in PCD

28

IntendedMatched

correct PCD

Page 64: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Faults in PCD

28

IntendedMatched

both neglected and unintended

correct PCD

Page 65: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Faults in PCD

28

IntendedMatched

both neglected and unintended

neglected joinpoints

correct PCD

Page 66: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Faults in PCD

28

IntendedMatched

both neglected and unintended

neglected joinpoints

unintended joinpoints

correct PCD

Page 67: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

•both neglected and unintended

29

pointcut controlledAccess(): execution(* Bank.*(int));

pointcut controlledAccess(): execution(boolean Bank.*(int));

matches deleteAccount() and getAccount()

matches deleteAccount() and login()

Page 68: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

•neglected joinpoints

30

pointcut controlledAccess(): execution(* Account.*(int));

pointcut controlledAccess(): execution(boolean Account.*(int));

matches withdraw() and deposit()

matches withdraw()

Page 69: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Mutant PCD

•A PCD where a fault has been inserted• Selects a different set of joinpoints

•Equivalent mutant• Mutant that matches the same set of joinpoint

• Equivalent mutants can be detected statically

31

Page 70: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Mutation Operators

32

Operator DescriptionPCCC Replaces a cflow by a cflowbelow, or the contraryPCCE Replaces a call by an execution, or the contraryPCGS Replaces a get by a set, or the contraryPCLO Changes the logical operators in a composition of PCDsPCTT Replaces a this by a target, or the contraryPOEC Adds, removes or changes throwing clausesPOPL Changes the parameter listPSWR Removes wildcardsPWAR Removes annotation from type, field or method patternsPWIW Adds wildcards

Page 71: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(* Account.*(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

33

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: an example – 1

Page 72: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

33

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: an example – 1

Page 73: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

33

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: an example – 1

Page 74: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(void Account.*(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

34

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 2

Page 75: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

34

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 2

Page 76: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

34

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 2

Page 77: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(* Account.*(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

35

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 3

Page 78: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

35

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 3

Page 79: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

35

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 3

Page 80: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(* *(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

36

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

Testing the PCD: example – 4

Page 81: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

36

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

Testing the PCD: example – 4

Page 82: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

36

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); try { account.withdraw(30); fail("Access should not be authorized"); } catch(DeniedAccessException() {}}

Testing the PCD: example – 4

Page 83: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Crosscutting aspects

38 open source projects:479 aspects, 522 advices in 21245 join-points

Page 84: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

38

AdviceTracer:writing PCD specific Oracles

•AdviceTracer: AspectJ library to write oracles that specifically target the PCD

•Oracles written with AdviceTracer for one PCD are:• Independent from the advices

• Independent from other PCDs

Page 85: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(* Account.*(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 86: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 87: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 88: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 89: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 90: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 91: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 92: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 93: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 39

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 1

Page 94: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(void Account.*(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

40

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 2

Page 95: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 40

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 2

Page 96: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 40

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 2

Page 97: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(* Account.*(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

41

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 3

Page 98: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 41

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 3

Page 99: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 41

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 3

Page 100: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public aspect AccessControl { pointcut controlledAccess(): execution(* *(int))

@AdviceName("AccessControl") before(): controlledAccess() { if(!checkAccess(thisJoinPoint.getTarget())) throw new DeniedAccessException(); }}

42

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 4

Page 101: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");} 42

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 4

Page 102: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); try { account.withdraw(30); } catch(DeniedAccessException() {} setAdviceTracerOff(); assertAdviceExecutionEquals(1); assertExecutedAdvice("AccessControl","Account.withdraw:47");}

42

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 4

Page 103: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); // System Test setAdviceTracerOff(); assertAdviceExecutionEquals(4);}

43

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 5

Page 104: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

✕public void testAccessControlDelete() { bank.login(nonAuthorizedUser,password); addTracedAdvice("AccessControl"); setAdviceTracerOn(); // System Test setAdviceTracerOff(); assertAdviceExecutionEquals(4);}

43

Bank+ login(String,String): boolean

+ deleteAccount(int): boolean

Account+ withdraw(int): boolean*

accounts

AdviceTracer: example – 5

Page 105: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

44

•R. Delamare, B. Baudry, S. Ghosh, Y. Le Traon. «An approach for testing pointcut descriptors in AspectJ». Journal of Software Testing, Verification and Reliability, 2011.

Page 106: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

QLTF for AOP

45

ack

tester SUTtest(t,j)

usage of PCD

AdviceTracermutation tool

contracts for AOP

which faults?Software construction paradigm

Page 107: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Cloud computing

•Build order of magnitude bigger systems with order of magnitude less efforts•http://boom.cs.berkeley.edu/

•Distribution, communication and synchronization are hidden•establish trust in these mechanisms

•Design applications as atoms and bits• reason on pieces of programs

•understand the interactions between these pieces and the cloud framework

46

Page 108: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

MapReduce

47

Page 109: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

48

Word count

Page 110: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

49

Word count

Page 111: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

MapReduce application

•Two independents parts•Mapper processes a bit of information; 1-to-1 input/

output sources

•Reducer processes n mapped bits of information in a global result; n-to-1 I/O sources

•+ configuration, dispatch modules

50

Page 112: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

•Map and reduce modules rely on•high level languages

• low level arithmetic, control, etc. are hidden from the programmer

•that have been heavily tested• i.e., we can trust the iterator Java library

•framework that abstracts I/O and distribution operations• all errors are handled by the framework (e.g., Hadoop)

51

Page 113: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

MapReduce faults

•Some faults in map and reduce•logic, arithmetic

•Most of them elsewhere• ‘cutting’ a function in map and reduce is a hard design task

• understanding the MapReduce framework is hard

52

Page 114: Evolving mutation from objects to the cloud · •An illustration: aspect-oriented programming. 3 1. The scope of software testing practice and research is broadening. 1. The scope

Conclusion

•New ways of building software

•require new ways of testing it

•Mutation analysis can play a central role

•understanding faults in the methods and techniques

•focusing testing on relevant defects

•tailoring testing research questions

53