1 / 51

Behavioral Modeling, Debugging and Testing @ Model Level

Behavioral Modeling, Debugging and Testing @ Model Level. Andrei Kirshin, Dolev Dotan IBM Haifa Research Lab July 2008. IBM Haifa Research Lab – MDD Seminars. Modeling product lines June 23, 2008. Julia Rubin Behavioral Modeling, Debugging and Testing @ Model Level

kuper
Télécharger la présentation

Behavioral Modeling, Debugging and Testing @ Model Level

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Behavioral Modeling,Debugging and Testing @ Model Level Andrei Kirshin, Dolev Dotan IBM Haifa Research Lab July 2008

  2. IBM Haifa Research Lab – MDD Seminars • Modeling product lines • June 23, 2008. Julia Rubin • Behavioral Modeling, Debugging and Testing @ Model Level • July 7, 2008. Andrei Kirshin • Understanding complex models – static model understanding • [after summer holidays], 2008. Dany Moshkovich • Customizing MDD environments for different industrial domains • [after summer holidays], 2008. Shiri Kremer-Davidson

  3. Outline • Introduction • Motivation • UML Behavioral Modeling • Action Language • UML Model Debugger • Debugging capabilities • Debugging perspective • Diagram animation • Testing • Model testing • Model-based testing (test generation)

  4. Outline • Introduction • Motivation • UML Behavioral Modeling • Action Language • UML Model Debugger • Debugging capabilities • Debugging perspective • Diagram animation • Testing • Model testing • Model-based testing (test generation)

  5. Introduction – Vision Time Tools Developers Abstraction • Variety & versatility of users: business analysts, architects, developers, testers • Components, services, • features, behaviors, • actions, patterns • Model level debugging • Model level testing • Support for AL • Static model analysis MDD Code Generation MD • Many highly qualified developers • Structures, operations, statements, • expressions, classes, interfaces, packages • 3GL level debugging, • 3GL testing tools, OOD Compiler RE • Few experts • Registers, • low level commands • Assembler, • Assembly debugger PD • PD – Procedural Development, RE – Reverse Engineering, MD – Model Discovery

  6. Problem  Solution Problem • In model-centric development the behavior of the system is modeled along with the structure • Code is generated automatically from the model • Currently the testing and the debugging is done at the code level • Used in systems engineering • Becoming relevant to the IT world Solution • Identify defects at the model level • Earlier in the development cycle • At the same level that developer works Executable Model Code Debugging and Testing Runtime

  7. Model Debugger MDD and Model Debugger • Identify defects at a much higher level of abstraction, earlier in the development cycle ExecutableSpecification (e.g. code) Runtime Executable Model Execution Transformation

  8. ModelingTool IDE CodeDebugger ModelDebugger ModelTransformation Compiler Behavioral Modeling Toolset Traditional Software Development Model DrivenDevelopment

  9. UML2 Diagrams Interaction Class Diagram Sequence Diagram State Machine Diagram Composite Structure Diagram Component Diagram Communication Diagram Activity Diagram Interaction Overview Diagram Deployment Diagram Object Diagram Timing Diagram Structure Behavior Use Case Diagram Information Flow Diagram

  10. State Machines Features include: • Behaviors for: transition effects,state entry, do, exit • Composite states • Nested state machines • Concurrency (orthogonal states) • Transition guards • Conditionals (choice, junction) Integration with the Object Oriented Model: • Effect/entry/do/exit behaviors… • Guards… • …can access class attributes, call class operations, etc. • Triggers: • Operation calls • Attribute changes

  11. State Machines - Basic Syntax State Machine Initial State(no triggers on the outgoing transition) State Transition Entry Behavior Guard Do Behavior Exit Behavior Effect Behavior Trigger Internal Transition

  12. Composite States OR States OR States OR States

  13. Orthogonal States Regions AND States

  14. Pseudostates History Merge (junction) Initial Join Choice Fork Final State (actually not a pseudostate) Junction

  15. Connection Points and Connection Point References

  16. Activity Diagrams – “Sophisticated Flowcharts” Features include: • Control flow • Data flow • Conditionals (choice node,guards) • Concurrency (fork & join) • Nested behavior calls • Data stores Integration with the Object Oriented Model: • (“Opaque”) actions – code snippets… • Guard expressions… • …can access class attributes, call class operations, etc. • Actions for: • Calling operations • Reading and modifying attributes • Sending signals • and more…

  17. Activity – Basic Syntax Activity Guard Join Node Control Flow Activity Final Node Fork Node Merge Node Decision Node Initial Node Opaque Action Flow Final Node

  18. Activity – Implicit Fork/Join Implicit Fork Implicit Join

  19. Activity – Object Flow/Nodes Input Pin Activity Parameter Node Output Pin Value Pin Object Flow

  20. Activity – More Actions… Call Operation Action Call Behavior Action Read Self Action Target Object Target Object Accept Event Action Sent Signal Action …And these are not all actions!

  21. UML Behavioral Modeling Summary • Structure: protocol, classes (capsules), ports and connectors • Behaviors (state machines, activities, interactions) • Stand-alone • Specify the implementation of operations • Specify the lifecycle (behavior) of objects • Specify state entry/do/exit behavior and transition effect • Code snippets (target language or platform independent) • Specify the implementation of operations • Specify state entry/do/exit behavior and transition effect • Activity actions • Guards (activity edge, state machine transition)  Flexible  Very complex (almost as complex as code)

  22. Action Language • Snippets of Code in the Model • Target language (Java, C++, C#) or its subset  Error prone, bound to specific target platform and compiler  Already known language • Platform independent  New language to learn  Makes the model retargetable, less error prone

  23. Outline • Introduction • Motivation • UML Behavioral Modeling • Action Language • UML Model Debugger • Debugging capabilities • Debugging perspective • Diagram animation • Testing • Model testing • Model-based testing (test generation)

  24. Interactive Debugging • Traditional debugging • Running a main function • Hitting a breakpoint • Stepping • Observing values • Changing values • Interactive debugging (model “exerciser”) • Creating instances • Destroying instances • Invoking operations and behaviors • Sending and broadcasting signals

  25. Model Debugging Perspective Breakpoints Debug Variables Event Pools Watch Diagram Animation Instances Signals Console Snippet I/O

  26. Instances View Create new instance Destroy instance • Dynamic debugging • Object creation and destruction • Attribute value observation • Operation invocation • Sending and broadcasting signals • Starting behaviors Toggle watch Send, broadcast signal Instance Attribute Invoke operation Start behavior Operation (double click to invoke)

  27. Debug View Pause Terminate • Control and display granularity – model elements • State, Transition, Action, Edge, etc. • Supports concurrency in behaviors – stack trace is a tree Step(into, over, out) Resume

  28. Variables View • Similar to Eclipse debugging framework view Self object Behavior parameters, attributes, and local variables

  29. Breakpoints View Skip all • Similar to Eclipse debugging framework view • Breakpoints • Statemachine: State, Transition, Entry, Do, Exit, Effect • Activity: Action Remove all Do activity of state B Remove Transition from A to B State A (disabled)

  30. Event Pools View • Shows pending events in event the pools of active objects Pending events

  31. Watch View • Shows watched instances

  32. Signals and I/O Views Send, broadcast signal Double-click to send signal Signals history

  33. Diagram Animation – State Machine Running transition Breakpoint Active (current) state Execution pending

  34. Diagram Animation – Activity Execution pending Token provider Offer path

  35. Running Transition Execution Pending Current State Breakpoint Model Debugging – Current Status • Debugging of behavioral UML models by emulation,supporting • Class, Composite Structure Diagrams • State Machines, Activities • Java as Action Language • Extensible to support UML profiles • Debugging UI – Model Debugging Perspective (next slide) • Diagram animation • Traditional Debugging • Start “main” • Run to breakpoint • Stepping • Interactive debugging(model “exerciser”) • Manually create objects • Invoke operations • Send signals

  36. User Debugging Generated Code (another possible approach) Code-Level Control Code-Level Observation Model-Level Observation Model-Level Control Model Model Debugger Code-Level Control Code-Level Observation Mapping between Model and Code CDT Debugger Code Control Observation Binary

  37. Debugging Generated Code – Details Main idea: • Extend the transformation framework to produce model to code mapping • Use the mapping to drive debugging using the Eclipse debug framework (by translating events between code-level and model-level) • No need to instrument the code UML debugging in the absence of a concrete transformation: • Produce a default transformation from UML behaviors to code (extend RSD’s structural UML to code transformations) Research challenges: • How to create a model debugging framework that can work with any given transformation? • How to create a default transformation that covers all UML behaviors? • How to make these extensible to support different semantics/platforms/languages/UML profiles? • How to support incomplete models? • Scalability issues – debug large models

  38. Outline • Introduction • Motivation • UML Behavioral Modeling • Action Language • UML Model Debugger • Debugging capabilities • Debugging perspective • Diagram animation • Testing • Model testing • Model-driven testing (test generation)

  39. Model-Level Testing – Architecture UML Model Application Code Generation Runtime monitoring Model Debugger Test Execution Environment Test Generator Testexecution on model Debugging session recording Automatic test generation Test execution on application Test Manualtest creation

  40. Debugging – Model Interpretation UML Model Application • Simulation / Emulation (for debugging and understanding) • Recording of execution traces (assisted test generation) Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace

  41. Debugging – Generated Code UML Model Application • Execution monitoring and control • Execution trace animation • Trace analysis results visualization Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace

  42. Automatic Test Generation UML Model Application • Test is a sequence of stimuli and observations • Model is used as the oracle to predict the expected results • A bunch of tests is generated automatically according to provided criteria Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace

  43. Test Editing UML Model Application • Manual test creation using model-level terms • Editing of tests generated using the Test Generator or Model Debugger traces Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace

  44. Model Testing UML Model Application • Execution of tests on the model • Used for model regression testing and test-first modeling approach Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace

  45. Model-Driven Testing of Applications UML Model Application • Execution of tests on the application • Transformation to concrete test execution environment Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace

  46. Developer Tester Abstract Model of the System Under Test 2 Test Generator 3 Abstract TestSuite Spec 1 4 System Under Test Test ExecutionEngine TestTrace Model-Driven Testing Process • In parallel to the development • Create the test model (less detailed than development model) • Generate the tests • Execute the tests on the application

  47. Testing Summary • Test creation • Manual (test editor) • Assisted (execution trace recording) • Automatic test generation • Model Testing • Execution of tests on the model • Used for model regression testing and test-first modeling approach • Model-Driven Testing of Systems • Transformation to concrete test execution environment • Execution of tests on the application

  48. Summary • MDD is a practical option for improving SW production and capitalizing on existing SW assets through: • Abstraction • Automation • Legacy modernization • UML Behavioral Modeling • Action Language • UML Model Debugger • Model testing • Model-driven testing of applications

  49. Research Topics • Concept of model debugging • Extensibility of the debugger • Scalability • UI • Technology • Action Language • Testing

  50. References • IBM Haifa Research Lab – Model Driven Engineering Technologies group http://www.research.ibm.com/haifa/dept/services/mdet.html • Model Debugger http://www.research.ibm.com/haifa/projects/software/ple/mex/index.html • UML http://www.uml.org/ • Contacts: Andrei Kirshin, Dolev Dotan, Julia Rubin {kirshin,dotan,mjulia}@il.ibm.com

More Related