210 likes | 318 Views
Generating test cases specifications for BPEL compositions of web services using SPIN. José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner Stefan 13.01.2014. Contents. Introduction Specification of web services compositions with BPEL
E N D
Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner Stefan 13.01.2014 AK Softwaretechnologie 1 WS 2013/14
Contents • Introduction • Specification of web services compositions with BPEL • Overview of the generation of test cases specifications • Transforming BPEL specifications into PROMELA • Using SPIN to generate test case specifications • Conclusion AK Softwaretechnologie 1 WS 2013/14
Introduction • Web as a Commercial Channel • Certain exchange protocol XML • Software with XML as Input and Output • XML based Web Services • Distributed • Asynchronous • Platform independent • Low coupled AK Softwaretechnologie 1 WS 2013/14
Introduction • Compositions of Web Services • Business Process Execution Language (BPEL) • Testing Web Services • Asynchronous behavior • Distribution • Availability • Lack of user Interface AK Softwaretechnologie 1 WS 2013/14
Specification of WS with BPEL • XML-Documents • Declarations • Specifications • Declarations • Partners • Variables • Specification • Basic Activities (Assign, Invoke, Receive) • Structured Activities (Sequence, Flow, While) AK Softwaretechnologie 1 WS 2013/14
BPEL Example AK Softwaretechnologie 1 WS 2013/14
<processname="loanapproval" [...]> <variables> <variablename="riskAssessment" messageType="asns:riskAssessmentMessage"/> [...] </variables> <partners> <partnername="customer" [...]/> <partnername="assessor" [...]/> <partnername="approver" [...]/> </partners> <flow> <links> <linkname="receive-to-assess"/> <linkname="assess-to-setMessage"/> [...] </links> <receive name="receive1" partner="customer" [...]> [...] </receive> ... AK Softwaretechnologie 1 WS 2013/14
<invokename="invokeAssessor" partner="assessor" portType="asns:riskAssessmentPT" operation="check" inputVariable="request" outputVariable="riskAssessment"> <targetlinkName="receive-to-assess"/> <sourcelinkName="assess-to-setMessage" transitionCondition= "bpws:getVariableData(’riskAssessment’, ’risk’)=’low’"/> <sourcelinkName="assess-to-approval" transitionCondition=" bpws:getVariableData(’riskAssessment’, ’risk’)!=’low’"/> </invoke> [...] </flow> </process> AK Softwaretechnologie 1 WS 2013/14
Business Process AK Softwaretechnologie 1 WS 2013/14
Test case specification generation • Simple PromelaInterpreter – SPIN • LTL Formulae used for Property-specification • How it works? • SPIN searches all possible states within the model • Checks whether the properties hold • If not gives a Counter Example • Generate Test Cases with SPIN • Transform Counter Example to Test Cases • Process/Protocol Meta Language – PROMELA • Describes models of distributed Systems AK Softwaretechnologie 1 WS 2013/14
Test case specification generation • Composition Under Test (CUT) is transformed into PROMELA • Transitions are identified • Mapping Transitions onto the Model • Transition expressed as LTL Property • Run SPIN with the Model and the Input LTL-Properties • Generate Test Cases with the produced Counter Example AK Softwaretechnologie 1 WS 2013/14
Test case specification generation AK Softwaretechnologie 1 WS 2013/14
Transforming BPEL specifications into PROMELA • PROMELA also includes BPEL-partners • BPEL portTypes transformed to PROMELA message channels • chanloanassessor_riskPort_IN = [QLENGTH] of {byte, byte, byte}; • Input and Output channel • Message Types are declared as typedefs • Invoke Activity = ! • Receive Activity = ? AK Softwaretechnologie 1 WS 2013/14
Transforming BPEL specifications into PROMELA - Example BPEL_loanApprovalPort_OUT! approvalInfo.accept • Sends a messagecontainingthe variable approvalInfo.accept • tochannelBPEL_loanApprovalPort_OUT AK Softwaretechnologie 1 WS 2013/14
Transforming BPEL specifications into PROMELA – Web Service • If the BPEL specification has no reference to the data, it will be given an undefinedvalue • If the data is compared to a numerical constant, it will be given the value of the constant, a lower value and a higher third value • If the data is discrete, it will be given each of the discrete constants in the BPEL specification and a value different from them, called other AK Softwaretechnologie 1 WS 2013/14
Transforming BPEL specifications into PROMELA – Transitions • BPEL is modelled in PROMELA • transitions are identified in the specification and are mapped within the model • Implicit Transitions • Invoke • Flow • While • Explicit Transitions • Are identified from link constructs • Explicitly transitions between activities (with same source or target) AK Softwaretechnologie 1 WS 2013/14
Using SPIN to generate test case specifications • Transition expressed as LTL Property • Unique Boolean variables tran1, tran2, tran3, … • Variable will get true in case of the transition being exercised by the model checker • The variable associated with a transition X is always false [] !tranX • Test Case stop if the property tranX is false • To get to end, change property to: • [] ( !tranX || !bpel_ends) AK Softwaretechnologie 1 WS 2013/14
Using SPIN to generate test case specifications • LTL property: [] ( !tran1 || !bpel_ends) • Example CounterExample for Transition 1, 3, 5: customer: request.amount = 3 customer: BPEL_loanApprovalPort_IN!request bpel: request.amount<4 bpel: tran1 = true bpel: loanassessor_riskAssessmentPort_IN!request assessor: riskAssessment.risk = low assessor: loanassessor_riskAssessmentPort_OUT! riskAssessment bpel: tran3 = true bpel: approvalInfo.accept = yes bpel: tran5 = true bpel: BPEL_loanApprovalPort_OUT!approvalInfo bpel: bpel_ends = true • Transformed into TestCase: • Input: Customer requests for an amount of 3 (less than four) • Input: Assessor sets risk to low • Output: reply to Customer is affirmative AK Softwaretechnologie 1 WS 2013/14
Using SPIN to generate test case specifications • Full transition coverage with three executions: • {1, 3, 5} • {1, 4, 6} • {2, 6} AK Softwaretechnologie 1 WS 2013/14
Conclusion • Generate test case specification from BPEL composition of web services • Method relies on SPIN Model Checker • Repeat execute to get a test suite for transition coverage • Independence from the particular implementation, only BPEL specification as input needed AK Softwaretechnologie 1 WS 2013/14
Any Questions? José García-Fanjul, Javier Tuya, and Claudio de la Riva. Generating testcasesspecificationsfor BPEL compositionsof web servicesusing SPIN. In Antonia Bertolinoand Andrea Polini, editors, in Proceedingsof International Workshop on Web Services Modeling andTesting (WS-MaTe2006), pages 83-94, Palermo, Sicily, ITALY, June 9th 2006. AK Softwaretechnologie 1 WS 2013/14