Unit testing a Soa Composite


Published on

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

Published in: Technology, Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Unit testing a Soa Composite

  1. 1. Unit testing a SOA Suite CompositeImportance of testing and tool usage and responsabilityRobert van Mölken, 19-03-2013 1
  2. 2. 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
  3. 3. 3" A good unit test will not onlyflush out problems before youget close to production, but it will help regression test your system as well.”
  4. 4. 4 Why testing an important facet is More expensive to fix defects in later phases Too many (IT) projects failTwo reasons are budget and quality control Ideal defect removal by phase
  5. 5. 5 5 reasons why Unit Testing is Important and fun 2. Use as a template for future process and/or code changes3. Leads to a Better design 4. Know how the code works and reacts on different scenario’s
  6. 6. 6 5 reasons why Unit Testing is Important and fun5. Confidence in Your code and “Refactor without Fear”
  7. 7. 7 Options for testing your code Front-endJava backend Middleware
  8. 8. 8 Unit testing with SOA Suite testsuites frameworkResponsability of SOA Suite within test cycle
  9. 9. 9 Creating a Test SuiteRight-click on testsuites folder in SOA project to create a new suite
  10. 10. 10 Creating a Composite TestRight-click on tests folder in SOA project to create a new test
  11. 11. 11 Emulating a Service CallService operations can be emulated, via manual value or imported file
  12. 12. 12 Emulating a Service ResponseService response can be emulated, if not service is really called
  13. 13. 13 Asserting Input / OutputRequest and response messaged can be asserted on expected data
  14. 14. 14 Component testing (PS5+)Since PS5 it is possible to assert data of BPEL component activities
  15. 15. 15 Component data assertionAsserting is possible on almost every activity. Based on primitives, xml similar, etc. It is also possible to assert the execution count.
  16. 16. 16 Reporting (enterprise manager)Tests can be run via the enterprise manager. Which reports the results.
  17. 17. 17Demo time: SOA Suite test framework
  18. 18. (Unit) testing with SoapUIResponsability of SoapUI within test cycle
  19. 19. 19 Setup tests within SoapUI (1/4)SoapUi project based on a service WSDL Add multiple service bindings to project
  20. 20. 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
  21. 21. 21 Setup tests within SoapUI (3/4)Generating a testsuite is easy by using a wizard with a few options
  22. 22. 22 Setup tests within SoapUI (4/4)After generating you will have a testsuite with testcase(s) and teststep(s)
  23. 23. 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)
  24. 24. 24 SoapUi Teststeps• 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
  25. 25. 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.
  26. 26. 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 AntA 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
  27. 27. 27Demo Time: SoapUi Hands-on
  28. 28. How do they stack up to each otherAspect SOA Suite SoapUI (DBUnit)Setup Environment + +-Setup Testcases + +Easy to adjust / clone - ++Real unit testing ++ +-Integration testing - ++Continuous integration + ++Reporting ++ +Assertion of data -- ++
  29. 29. Conclusion:Unit testing is important, cuts time & costs and gives a developer confidence!