资源描述
Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,*,Generation of TTCN-3 Test Cases from Use Case Map Scenarios,Bryan Mulvihill,Supervised by Dr. Daniel Amyot,1,Goal,The goal of this project is to convert Use Case Map Scenarios to test goals and test cases expressed in Testing and Test Control Notation version 3.,2,What are Use Case Maps?,Use Case Maps (UCMs) are a scenario-based software engineering technique that have a history of application to the description of object-oriented systems and reactive systems in various areas, including wireless, mobile, and agent domains.,UCMs are used as a visual notation for describing causal relationships between responsibilities of one or more use cases,.,UCMs model the functional requirements as scenarios,.,3,Use Case Map Example,4,Use Case Map Scenarios,Scenarios define a path through the UCM given a set of conditions.,Allows for the extraction of individual scenarios from an integrated collection for visualization, analysis, and conversion to other representations.,5,Use Case Map Scenario Example,Scenario follows the red line.,6,Testing and Test Control Notation 3,TTCN-3 is a flexible and powerful language applicable to the specification of all types of reactive system tests over a variety of communication interfaces,TTCN-3 is intended to be used for the specification of test suites which are independent of test methods, layers and protocols.,TTCN-3 is not restricted to conformance testing and can be used for many other kinds of testing including interoperability, robustness, regression, system and integration testing.,In earlier versions of the language TTCN stands for Tree and Tabular Combined Notation. The new meaning Testing and Test Control Notation is more apt for TTCN-3.,7,Purpose of this Project,Develop test cases from functional requirements.,Show proof of concept.,8,Technologies Used,XML UCM Scenarios are defined by an XML format.,Java & Xerces Parser Used to read in scenario and manipulate Document Object Model (DOM).,XSLT & Xalan Used to convert DOM using a stylesheet.,9,Structure of a UCM Scenario,10,Structure of a TTCN-3 Module,The principal building blocks of TTCN-3 are,module,s.,Modules,may define a suite of,testcases, or just a library.,Modules,mainly consist of:,Functions, used for commonly executed behaviour. Much like functions in C+ or methods in Java.,Signature declarations, declares a method called across a port. Acts like a remote procedure call.,Components, data types that,testcases,run on. A main test,component,(MTC) is created when the,testcase,is executed.,Testcases, an executable portion of the,module,. A,module,may contain any number of,testcases,.,11,TTCN-3 Ports,Ports are how,components,communicate with the system under test (SUT) and other components. TTCN has three types of ports:,Message allows for sending data.,Procedure allows for remote procedure calls (defined by signatures).,Mixed acts as both a message based port and procedure based port.,12,TTCN Example,/* An example module */,module,Example,/ Port declaration,type,port,MyPortType,procedure,inout all,/ Component declaration,type,component,MyTestComponent,port MyPortType MyPort,13,/ Function definition,function,MyFunction(,inout,integer,foo),foo := 10 * foo;,/signature declaration,signature,MyMethod(,in,integer,num),return,charstring;,testcase,ExampleTestCase(),runs,on,MyTestComponent,system,MyTestComponent,map(,mtc,:MyPort,system,:MyPort);,thePort.call(MyMethod:3);,alt, thePort.getreply(MyMethod:3 value “success”) , thePort.getreply /non zero value, fail,verdict.set(,fail,);,verdict.set(,pass,);,14,Mappings,Group a group of scenario elements.,group,elements map to TTCN,module,s. Each,module,is put into its own TTCN file.,module,GroupName,/*group description*/,.,XML of UCMS,Generated TTCN,15,Mappings,Scenario - A,scenario,is a sequential or parallel set of instructions. These map to TTCN,testcases,.,testcase,ScenarioName(),runs,on,DefaultComponent,system,DefaultSystemComponent,.,XML of UCM Scenario,Generated TTCN,16,Mappings,Par Represents,a set of instructions to be executed in parallel.,par,elements are modelled as parallel test,components,(PTC) and called when encountered in the,scenario,. This requires the group template to look for,par,elements and create,functions,for each set of instructions in them. When they are encountered in the,scenario, a PTC is created and started for each set of instructions in the,par,element.,17,XML of UCM Scenario,function,PTC001(),runs on,DefaultPTC,.,function,PTC002(),runs on,DefaultPTC,.,/in scenario,var DefaultPTC PTC001;,PTC001 := DefaultPTC.create;,PTC001.start(PTC001();,var DefaultPTC PTC002;,PTC002 := DefaultPTC.create;,PTC002.start(PTC002();,PTC001.done;,PTC002.done;,Generated TTCN,18,Mappings,Do Resp type The,do,element with type “Resp” (short for responsibility) acts as a remote procedure call to a,component,. A call to the right signature is made, and the reply is checked for success.,thePort.call(Security00_00Acquire);,alt, thePort.getreply(Security00_00Acquire value 0) , thePort.getreply/non zero value, fail,verdict.set(fail);,XML of UCM Scenario,Generated TTCN,19,Putting it All Together,20,module,PassWord,/*,*/,/Port type definition,type,port,MixedPort,mixed,inout,all,timer,Wait4PW;,signature,Security00_00LogRej(),return,integer,;,signature,Security00_00CheckID(),return,integer,;,signature,Security00_00Reject(),return,integer,;,/ Default Component,type,component,DefaultComponent,port,MixedPort thePort;,type,component,DefaultPTC,port,MixedPort thePort;,21,function,PTCN12(),runs on,DefaultPTC,/Start,thePort.call(Security00_00CheckID);,alt, thePort.getreply(Security00_00CheckID value 0) , thePort.getreply /non zero value, fail,verdict.set(,fail,);,Wait4PW.start;,function,PTCN23(),runs on,DefaultPTC,/Start,testcase,PWNotOK(),runs,on,DefaultComponent,system,DefaultComponent,map(,mtc,:thePort,system,:thePort);,var DefaultPTC vPTCN12:= DefaultPTC.create;,vPTCN12.start( PTCN12() );,var DefaultPTC vPTCN23:= DefaultPTC.create;,vPTCN23.start( PTCN23() );,vPTCN12.done;,vPTCN23.done;,22,Wait4PW.stop;,thePort.call(Security00_00Reject);,alt, thePort.getreply(Security00_00Reject value 0) , thePort.getreply /non zero value, fail,verdict.set(fail);,thePort.call(Security00_00LogRej);,alt, thePort.getreply(Security00_00LogRej value 0) , thePort.getreply /non zero value, fail,verdict.set(,fail,);,verdict.set(,pass,);/by default everything passes,23,Signatures and Generated Java Code,From the known Components and signatures, Java classes and corresponding methods can be created. This creates a skeleton for the test environment.,24,signature,Security00_00Acquire(),return,integer;,signature,Security00_00CheckID(),return,integer;,/Security.java,public,class,Security,public,static,int,Acquire(),return 0;,public,static,int,CheckID(),return 0;,Signatures,Generated Java,25,TTthree,TTthree,is a TTCN-3 parser and compiler. Written by Testing Technologies,TTthree,builds a .jar the TTCN module that can be executed by,TTman, a TTCN test management application.,Generated TTCN scripts were tested and compiled using,TTthree,.,26,Future Additions,Execute,testcases,using,TTman,.,Clean up,component,names before transformation.,Use state information from UCM scenario in TTCN script.,Multiple test,components,for a distributed test environment.,27,Thank You!Any questions?,28,
展开阅读全文