Unit Testing in SOA Suite 12C

In this article, I will show you the steps of preparing test cases for a particular SOA application. For this example, I have created a simple mediator service which will display the output as Hello + input string.

  1. Create a simple SOA application on mediator like below screenshot. Soap service will be WSDL driven. Download the WSDL from this link and keep it in WSDL folder of this application.Testing_SOA_Application_1
  2. Now create test suites for this application. Testsuites folder will be created automatically at the time of application creation. Right click on testsuites folder -> Create Test Suite. Enter test suite name.Testing_SOA_Application_2 Testing_SOA_Application_3
  3. Click on OK button and then test creation wizard will open. Enter test name and description.Testing_SOA_Application_4
  4. Click on NEXT button and select service and operation in the next wizardTesting_SOA_Application_5
  5. Enter input xml in input message part. A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A�<singleString xmlns=”http://xmlns.oracle.com/singleString”>Messi</singleString>Testing_SOA_Application_6
  6. Click on NEXT button and enter expected output xml in the reply part. A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A�A�<singleString xmlns=”http://xmlns.oracle.com/singleString”>Hello Messi</singleString>Testing_SOA_Application_7
  7. Click on FINISH button. Now test1.xml file will look like thisTesting_SOA_Application_8
  8. Left side of the mediator is the ASSERT part and right side will be the EMULATOR. Now right click on the dotted line in the right part of mediator and select Create Asserts and Emulates. Assertion enables you to validate the test data in the entire xml document by extracting a value and comparing it to an expected value. You can create assertion to validate an entire xml document, a part of message or a leaf element at any point of execution of SOA composite application. Emulation is used to simulate the message data that the SOA composite receives from the web services.Testing_SOA_Application_9
  9. Go to Emulates tab and click on green plus icon. Select Emulate Output radio button and enter the payload value. This emulates value and output message part should be matched, then only test will be succeeded, otherwise test will be failed. A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� A� <processResponse xmlns=”http://xmlns.oracle.com/BPELDemoApplication/HelloWorldBPEL/HWBPELProcess”><result>Hello Messi</result></processResponse>Testing_SOA_Application_10
  10. Click on OK buttonTesting_SOA_Application_11
  11. Final test case will look like below screenshotTesting_SOA_Application_12
  12. Go to Enterprise Console and select Unit Tests tab under the applicationTesting_SOA_Application_13
  13. Select test1.xml and click on Execute. Enter the details of test runTesting_SOA_Application_14
  14. Click on OK button. Result of test run window will open.Testing_SOA_Application_15
  15. Click on Refresh Test Status button. You will get the test result. Test result should be passed as both output message and emulate payload are same.Testing_SOA_Application_16

Now we will check the failed test case.

  1. Change the Emulate payload to Hello Pele.<processResponse xmlns=”http://xmlns.oracle.com/BPELDemoApplication/HelloWorldBPEL/HWBPELProcess”><result>Hello Pele</result></processResponse>Testing_SOA_Application_17
  2. Test the same unit test case and see the result. The result will be failed as the output is not matching with the emulate payload.Testing_SOA_Application_18

How to create Configuration Plan in jdeveloper 12C:-

Configuration plan applies to the SOA composite during deployment. In normal case, jdeveloper does not have any configuration file and the values from project will be taken into account during deployment.

This section will describe the following points a��

  • Generate configuration plan and edit it according to project requirement
  • Validate configuration plan and log file will be created after validation where you will find the changed value
  • Attach that configuration plan during deployment of SOA composite
  • Deploy the SOA composite application in which configuration file is attached

Open SOA application where you want to attach configuration file. Right click on composite.xml and select Generate Config PlanSOA_Configuration_Plan_1

This creates configuration file for editing. Here you can change search and replace rules of jca adapter with appropriate string value according to your deployment environment. You can also change the location and port of web service and WSDL.SOA_Configuration_Plan_2

After editing the configuration file validate this file. Right click on composite.xml and select Validate Config PlanSOA_Configuration_Plan_3

This will generate a log fileSOA_Configuration_Plan_4

Finally attach this configuration plan during SOA composite deployment.SOA_Configuration_Plan_5

You can attach the configuration plan at EM console also while deploying SAR (Service Archive) into weblogic server.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here