Darius Silingas - From Model Driven Testing to Test Driven Modelling
-
Upload
eurostar-software-testing-conference -
Category
Software
-
view
38 -
download
0
Transcript of Darius Silingas - From Model Driven Testing to Test Driven Modelling
From Model-Driven Testingto Test-Driven Modelling
Dr. Darius SilingasPrincipal Consultant @ No Magic
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
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
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
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
Data Architecture
7
MagicTest Data Structure
SelectionAsnwerClosedQuestion
OpenQuestion
AnswerOption
AssessmentInputAnswer
TestState
Question
Answer
Test
MagicTest
MagicUniversity Data Structure
UniversityMember
AcademicRoleClassStateTeacher
StudentCourse
Class
MagicUniversity
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?
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
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..*
Build Bigger Representative Samples
13
A data designer should prepare it along with data structure Testers should take over with creating variations
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
Modelling Interaction Scenario at Business Logic Layer
16 Service operations are discovered based on scenarios
+startTestAssessment()+submitAnswer()+finishTestAssessment()-evaluateTestAssessment()
«component»TestAssessmentService
+getQuestion()
«component»TestManagementService
Take Test Assessment Take Test Assessmentinteraction [ ]
: TestAssessmentService : TestManagementService
getQuestion()2:
question14:
getQuestion()6:
question28:
evaluateTestAssessment()10:
evaluation11:
question13:
question27:
submitAnswer()5:
finishTestAssessment()9:
startTestAssessment()1:
...
«component»TestManagementService
...
«component»TestAssessmentService
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
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]
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
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
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 andtake more time for thinking about the questions.
8
Finish
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
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
The End
Thank You for the attention!
Any Questions???Let’s Keep in Touch:
E-mail: [email protected]: darius.silingasGet connected at LinkedIn social network
25