21
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 Pointner Stefan AK Softwaretechnologie 1 WS 2013/14 1

Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

Embed Size (px)

Citation preview

Page 1: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 1

Generating test cases specifications for BPEL

compositions of web services using SPIN

José García-Fanjul, Javier Tuya, and Claudio de la Riva

Pointner Stefan13.01.2014

Pointner Stefan

Page 2: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 2

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

Pointner Stefan

Page 3: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 3

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

Pointner Stefan

Page 4: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 4

Introduction

• Compositions of Web Services• Business Process Execution Language (BPEL)

• Testing Web Services• Asynchronous behavior• Distribution• Availability• Lack of user Interface

Pointner Stefan

Page 5: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 5

Specification of WS with BPEL

• XML-Documents• Declarations• Specifications

• Declarations• Partners• Variables

• Specification• Basic Activities (Assign, Invoke, Receive)• Structured Activities (Sequence, Flow, While)

Pointner Stefan

Page 6: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 6

BPEL Example

Pointner Stefan

Page 7: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 7

<process name="loanapproval" [...]><variables>

<variable name="riskAssessment"

messageType="asns:riskAssessmentMessage"/>[...]

</variables><partners>

<partner name="customer" [...]/><partner name="assessor" [...]/><partner name="approver" [...]/>

</partners><flow>

<links><link name="receive-to-assess"/><link name="assess-to-setMessage"/> [...]

</links><receive name="receive1" partner="customer" [...]>

[...]</receive>

...Pointner Stefan

Page 8: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 8

<invoke name="invokeAssessor" partner="assessor"portType="asns:riskAssessmentPT"operation="check"inputVariable="request"outputVariable="riskAssessment">

<target linkName="receive-to-assess"/><source linkName="assess-to-setMessage"transitionCondition="bpws:getVariableData(’riskAssessment’,’risk’)=’low’"/><source linkName="assess-to-approval"transitionCondition="bpws:getVariableData(’riskAssessment’,’risk’)!=’low’"/>

</invoke> [...]</flow>

</process>

Pointner Stefan

Page 9: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 9

Business Process

Pointner Stefan

Page 10: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 10

Test case specification generation

• Simple Promela Interpreter – 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

Pointner Stefan

Page 11: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 11

Test case specification generation

1. Composition Under Test (CUT) is transformed into PROMELA2. Transitions are identified3. Mapping Transitions onto the Model4. Transition expressed as LTL Property5. Run SPIN with the Model and the Input LTL-Properties6. Generate Test Cases with the produced Counter Example

Pointner Stefan

Page 12: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 12

Test case specification generation

Pointner Stefan

Page 13: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 13

Transforming BPEL specifications into PROMELA• PROMELA also includes BPEL-partners• BPEL portTypes transformed to PROMELA message channels• chan loanassessor_riskPort_IN = [QLENGTH] of {byte, byte, byte};• Input and Output channel• Message Types are declared as typedefs

• Invoke Activity = !• Receive Activity = ?

Pointner Stefan

Page 14: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 14

Transforming BPEL specifications into PROMELA - ExampleBPEL_loanApprovalPort_OUT! approvalInfo.accept

• Sends a message containing the variable approvalInfo.accept• to channel BPEL_loanApprovalPort_OUT

Pointner Stefan

Page 15: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 15

Transforming BPEL specifications into PROMELA – Web Service• If the BPEL specification has no reference to the data, it will be given

an undefined value

• 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

Pointner Stefan

Page 16: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 16

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)

Pointner Stefan

Page 17: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 17

• 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)

Pointner Stefan

Using SPIN to generate test case specifications

Page 18: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 18

Using SPIN to generate test case specifications

• LTL property: [] ( !tran1 || !bpel_ends)• Example CounterExample for Transition 1, 3, 5:

customer: request.amount = 3customer: BPEL_loanApprovalPort_IN!requestbpel: request.amount<4bpel: tran1 = truebpel: loanassessor_riskAssessmentPort_IN!requestassessor: riskAssessment.risk = lowassessor: loanassessor_riskAssessmentPort_OUT! riskAssessmentbpel: tran3 = truebpel: approvalInfo.accept = yesbpel: tran5 = truebpel: BPEL_loanApprovalPort_OUT!approvalInfobpel: 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

Pointner Stefan

Page 19: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 19

Using SPIN to generate test case specifications

Pointner Stefan

Full transition coverage with three executions:• {1, 3, 5}• {1, 4, 6}• {2, 6}

Page 20: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 20

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

Pointner Stefan

Page 21: Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner

AK Softwaretechnologie 1 WS 2013/14 21

Any Questions?

José García-Fanjul, Javier Tuya, and Claudio de la Riva. Generating test cases specifications for BPEL compositions of web services using SPIN. In Antonia Bertolino and Andrea Polini, editors, in Proceedings of International Workshop on Web Services Modeling and Testing (WS-MaTe2006), pages 83-94, Palermo, Sicily, ITALY, June 9th 2006.

Pointner Stefan