1 / 22

I nstitute for Software Technology Graz University of Technology Austria Sommersemester 2011

Model-Based Testing of Object-Oriented Reactive Systems with Spec Explorer. I nstitute for Software Technology Graz University of Technology Austria Sommersemester 2011. Outline. What is SpecExplorer ? Overview of SpecExplorer Controllable vs Observable methods Model program example

Download Presentation

I nstitute for Software Technology Graz University of Technology Austria Sommersemester 2011

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. Model-Based Testing of Object-Oriented Reactive Systems with Spec Explorer Institute for Software Technology Graz University of Technology Austria Sommersemester 2011

  2. Outline • What is SpecExplorer ? • Overview of SpecExplorer • Controllable vs Observable methods • Model program example • Scenario control • Offline vs Online Testing • Case Study

  3. What is SpecExplorer? • SpecExplorer is a tool for testing reactive, object orientated software systems • SpecExplorer is a tool to develop, explore and validate models • SpecExplorer generates test cases from models • SpecExplorer can execute tests against an implementation

  4. Overview of SpecExplorer(1) • System behavior is described by a model language • Model language is one of those: • Spec# • AsmL • C# • Visual Basic • Model program defines state variables and update rules of an abstract state machine • The states of the machine are first order structures

  5. Overview of SpecExplorer(2) • SpecExplorer explores machine's states • Result is a finite graph • Graph can be viewed in SpecExplorer • Graph is subset of states and transitions • SpecExplorer generates test cases for the explored behavior • Test cases are run against system under test(SUT) • SpecExplorer displays successful / failing tests

  6. Controllable vs Observable • Reactive systems are nondeterministic • SpecExplorer distinguishes input / output • 2 Types available • Controllable actions • Observable actions

  7. Model example class Client { bool entered; Map<Client,Seq<string>> unreceivedMsgs; [Action] Client() { this.unreceivedMsgs = Map; foreach (Client c in enumof(Client), c != this){ c.unreceivedMsgs[this] = Seq{}; this.unreceivedMsgs[c] = Seq{}; } entered = false; } [Action] void Enter() requires !entered; { entered = true; } [Action] void Send(string message) requires entered; { foreach (Client c in enumof(Client), c != this, c.entered) c.unreceivedMsgs[this] += Seq{message}; } [Action(Kind=ActionAttributeKind.Observable)] void Receive(Client sender, string message) requires sender != this && unreceivedMsgs[sender].Length > 0 && unreceivedMsgs[sender].Head == message; { unreceivedMsgs[sender] = unreceivedMsgs[sender].Tail; } }

  8. Model automation

  9. Scenario Control • Model program is unwound into a model automation • Contains large or infinite number of transitions • Solution? • Apply filter techniques • Maps model automation into new automation

  10. Scenario Control(1) - Parameter selection - Method restriction - State filtering - State grouping - Directed search

  11. Parameter selection • Parameter selection limits exploration to a finite set of parameters for the action methods • Add initial states • Add states which are reachable from initial states • 4 Levels of parameter control - Defaults, i.e boolean = false/true - Per type - Per parameter - Per method

  12. Method restriction • An action is enabled in the state s if the precondition of m is satisified • Method restriction is applied by strengthening the precondition • Note: Observable actions should be avoided - Why?

  13. State filtering • State based filtering prunes states that fail to satisfy a given state based predicate • Example: forall{ c in enumof(Client), s in c.unreceivedMsgs.Keys, m1 in c.unreceivedMsgs[s], m2 in c.unreceivedMsgs[s] m1 != m2 }

  14. Directed Search • SpecExplorer uses non-deterministic search to explore states and transitions • Transitions and states are explored untill user provided bound conditions are met • Initial states are captured • Transition exploration choices are based on state weights and action weights

  15. State grouping • State grouping is used to select representative states of an equivalence class • Used to prune exploration to distinct cases of interest for testing • Example: Bag { c in enumof(Client); <c.entered, Bag{<s,m> in c.unreceivedMsgs; m} > }

  16. Offline vs Online Testing • Offline test generation • Tests are generated in advance from a model • State space coverage / accepted state / random walks • Value iteration algorithm for negative Markov decision problems • Online test generation • Tests are generated as the model program is unfolded • OTF algorithm • Controllable actions are randomly choosen by OTF

  17. Case Study(1) • Microsoft Open Protocol Initiative • 222 protocols • 22.847 pages of specifications • 66.692 person days (270+ person years) • 350 test engineers in India / China • 36.875 requirements • 69 % tested using MBT • 31 % tested using traditional test automation

  18. Case Study(2)

  19. Conclusion • SpecExplorer is a tool to develop and test models • SpecExplorer provides powerful methods for visualizing models • Open problems: • Test coverage / suffiency metrics • Failure analysis(shorter paths?) • Continuation after failure

  20. Vielen Dank für die Aufmerksamkeit

  21. References [1] Model-Based Testing of Object-Oriented Reactive Systems with Spec Explorer http://tinyurl.com/3j4ovja [2] Microsoft's Protocol Documentation Program: A Success Story for Model-Based Testing http://tinyurl.com/3nfauuv [3] Optimal Strategies for Testing Nondeterministic Systems http://tinyurl.com/3st57br

  22. Fragen?

More Related