darius silingas - from model-driven testing - eurostar 2010

25
From Model-Driven Testing to Test-Driven Modelling Dr. Darius Silingas Principal Consultant @ No Magic

Upload: eurostar-software-testing-conference

Post on 01-Jul-2015

92 views

Category:

Technology


0 download

DESCRIPTION

EuroSTAR Software Testing Conference 2010 presentation on From Model-Driven Testing by Darius Silingas. See more at: http://conference.eurostarsoftwaretesting.com/past-presentations/

TRANSCRIPT

Page 1: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

From Model-Driven Testing

to Test-Driven Modelling

Dr. Darius Silingas

Principal Consultant @ No Magic

Page 2: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

What Is this Session About?

Disclaimer: I am not and have never been a Software Tester

… but I have worked with a lot of software testers

… and I know that a tester can figure out the bugs

… but a developer has to fix them

… and he can prevent them by using test-driven approach

This session is about installing testing approach into software modelling activities for getting better quality models and thus better quality software based on those models

2

Page 3: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Prerequisites

This is an advanced session, which assumes that you have:

A basic understanding of Model Driven Development

A basic understanding of Test Driven Development

A desire to build better quality software

3

Page 4: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Towards Synergy of Trends

Improve MDA with Agile practices

Raise the level of abstraction for Agile practices 4

AGILE Development

Test Driven Development

Model Driven Testing Test Driven Modelling

Page 5: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Eating Your Own Dog Food

Let’s practice example/test-driven approach and learn the

principles of Test Driven Modelling by analyzing how to apply

it to a small example system MagicTest.

MagicTest provides functionality for a teacher to create test

questions, group them into a test and assign it to the class

that he is teaching. The students of that classes make

assessments of the test that are automatically evaluated.

5

Page 6: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

System Layers

User Interface

6

Business Logic

Data Layer

Page 7: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Data Architecture

7

Page 8: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

MagicUniversity Data Structures

8

name : String [1]

cv : String [1]

title : String

Teacher

start : date [1]

end : date [1]

Class

name : String [1]

year : Integer [1]

Student

title : String [1]

code : String [1]

description : String [1]

credits : Integer [1]

Course

teacher 1

0..*

subject

1 0..*

0..*

prerequisites

0..*

supervisor 1

0..*

participants 1..*

0..*

How do I know if this data structure is suitable?

Page 9: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Representative Data Sample

9 A sample shows inconsistency with data structure

Page 10: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

What Can We Do When Sample Violates Data Structure

1. Fix data structure (sample is good, structure was wrong)

2. Fix data sample (sample is wrong, structure was good)

Use invalid sample in testing for ensuring that such cases are not

allowed and handled appropriately in the system

10

Page 11: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

MagicUniversity Data Structures

11

name : String [1]

cv : String [1]

title : String

Teacher

start : date [1]

end : date [1]

Class

name : String [1]

year : Integer [1]

Student

title : String [1]

code : String [1]

description : String [1]

credits : Integer [1]

Course

teacher 1

0..*

subject

1 0..*

0..*

prerequisites

0..*

supervisor 1

0..*

participants 1..*

0..*

Decision: Enable multiple supervisors

1..*

Page 12: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Representative Data Sample

12 A sample is now in sync with data structure

Page 13: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Build Bigger Representative Samples

13

A data designer should prepare it along with data structure

Testers should take over with creating variations

Page 14: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

System Layers

User Interface

14

Business Logic

Data Layer

Page 15: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Modelling Business Logic in UML

Identifying business logic services as UML components

Modeling interaction scenarios as UML sequence diagrams

• The operations of business components can be created as needed

• New necessary service components can be created as needed

• JUnit tests or their skeletons can be generated from interaction

scenarios

15 UML tools support these scenarios quite well

Page 16: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Modelling Interaction Scenario at Business Logic Layer

16 Service operations are discovered based on scenarios

+startTestAssessment()

+submitAnswer()

+finishTestAssessment()

-evaluateTestAssessment()

«component»

TestAssessmentService

+getQuestion()

«component»

TestManagementService

...

«component»

TestManagementService

...

«component»

TestAssessmentService

Page 17: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

System Layers

User Interface

17

Business Logic

Data Layer

Page 18: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

GUI Modelling in UML

GUI structure can be captured in UML class or composite

structure diagrams

Modern modelling tools typically provide graphical rendering to enable

better presentation for users and GUI designers/analysts

1. Identify abstract GUI screens as UML classes

2. Build abstract GUI navigation schema as UML state machine

3. Build a story board GUI sample set as UML instance

specifications for validating GUI design with data samples

Reuse data for GUI samples from data design (or vice versa)

18

Page 19: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

GUI Navigation Schema

19 How do I know it is suitable?

TestAssessmentWindow

StudentProfile UserDetails

TestResultsWindow

Authorized

submit login infoexit /

LoginDialog

OK

GetTestResults

EditData

OK

Finish

at (timeout)

TakeTest

all [session expired] [login incorrect] / show error msg

[password expired] / show change password fields

[password not expired]

Login

Quit

Start

[login correct]

Page 20: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Building GUI-Based Story Board Model (1)

20 Validates both navigation schema and screen structures

Profile

Edit Data

Get Test Results

Logout

Title:

Status:

Active:

Breaks:

Time Limit:

Instructions:

Magic Test

2009-05-25 - 2009-06-06

4

60

Active

None

Java Test (Advanced)

Magic Test

UML Test (Advanced)

UML Test (Beginner)

Take Test

Page 21: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Building GUI-Based Story Board Model (2)

21 Validates both navigation schema and screen structures

MagicTest: UML Basics

Question 2 Question 3 ... Question 10Question 1

How many standard diagram types does UML 2 define?

9

13

Pause Test < Back< Back Next > Finish Test

11Progress / 10

Page 22: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Building GUI-Based Story Board Model (3)

22 Validates both navigation schema and screen structures

Evaluation

Start:

End: 2009-05-29

2009-05-28 Taken Breaks:

Time elapsed (in Minutes): 17

0

Grade:

You finished the test quite well. You've made only 2 mistakes.

Keep it this way and you will finish other tests also.

Maybe even better if you concentrate a little bit more and

take more time for thinking about the questions.

8

Finish

Page 23: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Lessons Learned

1. Conceptual mistakes in design models can be found early by

validating it with example/test models

2. Quality engineers need to be involved in collaborative

modelling together with developers

Developers should produce essential example models

Testers should take over with creating variations for a better

coverage of error-prone situations

3. Example/test-driven modelling enables achieving a better

quality of model-driven software by testing design models

early

23

Page 24: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

Towards Practicing Test Driven Modelling

Tool aspect: Modelling tools like MagicDraw already provide partial support for

test-driven modelling – they are not a show stopper

Human aspect: Test-driven modelling requires a

change in modeller’s mindset for enabling

more mature modelling culture

Action point: bring these ideas back to your organisations and

see if you can influence a change

24

Page 25: Darius Silingas - From Model-Driven Testing - EuroSTAR 2010

The End

Thank You for the attention!

Any Questions???

Let’s Keep in Touch:

E-mail: [email protected]

Skype: darius.silingas

Get connected at LinkedIn social network

25