30
Importance of testing and tool usage and responsability Robert van Mölken, 19-03-2013 Unit testing a SOA Suite Composite 1

Unit testing a Soa Composite

Embed Size (px)

DESCRIPTION

Presentation about the importance of testing and two solutions to test a SOA Composite.

Citation preview

Page 1: Unit testing a Soa Composite

Importance of testing and tool usage and responsability

Robert van Mölken, 19-03-2013

Unit testing a SOA Suite Composite

1

Page 2: Unit testing a Soa Composite

2

What you will come to know

• Why testing an important facet is of product development

• Options for testing your code

• Which opties are commonly used for testing SOA applications

– SOA Suite Test Suite Framework• Unit testing / simulation of a SOA composite and components

– SoapUI (optional combined with DBUnit / Groovy)• Unit testing with use of datasources and XPath matching

• How do these solution stack up to each other

• Conclusion about what we know now

Page 3: Unit testing a Soa Composite

3

" A good unit test will not only flush out problems before you get close to production, but it will help regression test your

system as well.”

Page 4: Unit testing a Soa Composite

4

Why testing an important facet is

Too many (IT) projects fail

Two reasons are budget and quality control

More expensive to fix defects in later phases

Ideal defect removal by phase

Page 5: Unit testing a Soa Composite

5

5 reasons why Unit Testing is Important and fun

2. Use as a template for future process and/or code changes

3. Leads to a Better design

4. Know how the code works and reacts on different scenario’s

1. Execute code right away and enjoy result

Page 6: Unit testing a Soa Composite

6

5 reasons why Unit Testing is Important and fun

5. Confidence in Your code and “Refactor without Fear”

Page 7: Unit testing a Soa Composite

7

Options for testing your code

Front-end

Java backend

Middleware

Page 8: Unit testing a Soa Composite

8

Unit testing with SOA Suite testsuites framework

Responsability of SOA Suite within test cycle

Page 9: Unit testing a Soa Composite

9

Creating a Test Suite

Right-click on testsuites folder in SOA project to create a new suite

Page 10: Unit testing a Soa Composite

10

Creating a Composite Test

Right-click on tests folder in SOA project to create a new test

Page 11: Unit testing a Soa Composite

11

Emulating a Service Call

Service operations can be emulated, via manual value or imported file

Page 12: Unit testing a Soa Composite

12

Emulating a Service Response

Service response can be emulated, if not service is really called

Page 13: Unit testing a Soa Composite

13

Asserting Input / Output

Request and response messaged can be asserted on expected data

Page 14: Unit testing a Soa Composite

14

Component testing (PS5+)

Since PS5 it is possible to assert data of BPEL component activities

Page 15: Unit testing a Soa Composite

15

Component data assertion

Asserting is possible on almost every activity. Based on primitives, xml similar, etc. It is also possible to assert the execution count.

Page 16: Unit testing a Soa Composite

16

Reporting (enterprise manager)

Tests can be run via the enterprise manager. Which reports the results.

Page 17: Unit testing a Soa Composite

Demo time: SOA Suite test framework

17

Page 18: Unit testing a Soa Composite

(Unit) testing with SoapUI

Responsability of SoapUI within test cycle

Page 19: Unit testing a Soa Composite

19

Setup tests within SoapUI (1/4)

SoapUi project based on a service WSDL Add multiple service bindings to project

Page 20: Unit testing a Soa Composite

20

Setup tests within SoapUI (2/4)

Execute single operations without assertions Create testsuite(s) as a empty template or based on a service binding

Page 21: Unit testing a Soa Composite

21

Setup tests within SoapUI (3/4)

Generating a testsuite is easy by using a wizard with a few options

Page 22: Unit testing a Soa Composite

22

Setup tests within SoapUI (4/4)

After generating you will have a testsuite with testcase(s) and teststep(s)

Page 23: Unit testing a Soa Composite

23

SoapUi Teststeps

• Test step based on a SOAP service request

• Test step based on a Groovy script

• Test step for defining testcase properties

• Test step for transfering property values

• Test step for defining a conditionele goto

• Test step for defining a delay (in miliseconds)

• Test step for defining a call to another testcase (and other testsuite)

Page 24: Unit testing a Soa Composite

24

• Test step based on a REST request

• Test step based on a HTTP request (GET, POST, PUT…)

• Test step based on a MOCK service response

• Test step based on a JDBC query to database

• Test step based on a AMF (action message, AS3) request

• Test step to create a manual action of human interaction

SoapUi Teststeps

Page 25: Unit testing a Soa Composite

25

SoapUi Pro Teststeps

• Test step to setup a datasource which retrieves a dataset which can be used in other test steps

• Test step for defining a datasource loop

• Test step for exporting property values for reporting

• Test step for dynamically defining properties (current data/time)

• Test step to assert/validate property values, request or response messages.

Page 26: Unit testing a Soa Composite

26

Datasource step when using SoapUI Free

Commandline with Apache Ant it’s possible to start SoapUI

Within SoapUi you can define properties which can be overwritten by Ant

A property can be a reference to a file which can be read by groovy

Alternatively is the use of a DBUnit step in the Ant script to insert datasets

Page 27: Unit testing a Soa Composite

Demo Time: SoapUi Hands-on

27

Page 28: Unit testing a Soa Composite

How do they stack up to each other

Aspect SOA Suite SoapUI (DBUnit)

Setup Environment + +-

Setup Testcases + +

Easy to adjust / clone - ++

Real unit testing ++ +-

Integration testing - ++

Continuous integration + ++

Reporting ++ +

Assertion of data -- ++

Page 29: Unit testing a Soa Composite

Conclusion:

Unit testing is important, cuts time & costs and gives a developer confidence!

Page 30: Unit testing a Soa Composite