EuroSTAR Software Testing Conference 2010 presentation on From Model-Driven Testing by Darius Silingas. See more at: http://conference.eurostarsoftwaretesting.com/past-presentations/
2. 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
3. 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
4. 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
5. 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
8. 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?
10. 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
11. MagicUniversity Data Structures
11
name : Strnig [1]
cv: String [1]
title : String
Teacher
start : date [1]
end : date [1]
Class
name : Strnig [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..*
13. Build Bigger Representative Samples
13
A data designer should prepare it along with data structure
Testers should take over with creating variations
15. Modelling Business Logic in UML
Identifying business logic services as UML componentsModeling 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
16. Modelling Interaction Scenario at Business Logic Layer
Service operations are discovered based on scenarios 16
+startTestAssessment()
+submitAnswer()
+finishTestAssessment()
-evaluateTestAssessment()
«component»
TestAssessmentService
+getQuestion()
«component»
TestManagementService
...
«component»
TestManagementService
...
«component»
TestAssessmentService
18. 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
19. GUI Navigation Schema
19
How do I know it is suitable?
TestAssessmentWindowStudentProfileUserDetailsTestResultsWindowAuthorizedsubmit login infoexit / LoginDialogOKGetTestResultsEditDataOKFinishat (timeout) TakeTestall [session expired] [login incorrect] / show error msg [password expired] / show change password fields [password not expired] LoginQuitStart [login correct]
20. Building GUI-Based Story Board Model (1) 20
Validates both navigation schema and screen structures
ProfileEdit DataGet Test ResultsLogoutTitle: Status: Active: Breaks: Time Limit: Instructions: Magic Test2009-05-25 - 2009-06-06460ActiveNoneJava Test (Advanced) Magic TestUML Test (Advanced) UML Test (Beginner) Take Test
21. Building GUI-Based Story Board Model (2)
Validates both navigation schema and screen structures 21
MagicTest: UML Basics
Question 1 Question 2 Question 3 ... Question 10
How many standard diagram types does UML 2 define?
9
13
Pause Test << BBaacckk Next > Finish Test
Progress 1 / 10
22. Building GUI-Based Story Board Model (3)
22
Validates both navigation schema and screen structures
EvaluationStart: End:2009-05-292009-05-28Taken Breaks: Time elapsed (in Minutes):170Grade: 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. 8Finish
23. 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 situations3.Example/test-driven modelling enables achieving a better quality of model-driven software by testing design models early23
24. Towards Practicing Test Driven Modelling Tool aspect:Modelling tools like MagicDraw already provide partial support for test-driven modelling –they are not a show stopperHuman aspect:Test-driven modelling requires a change in modeller’s mindset for enabling more mature modelling cultureAction point:bring these ideas back to your organisations and see if you can influence a change
24
25. The End
Thank You for the attention!
Any Questions???
Let’s Keep in Touch:
E-mail:darius.silingas@nomagic.com
Skype:darius.silingas
Get connected at LinkedInsocial network25