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.
- 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.
- 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.
- Click on OK button and then test creation wizard will open. Enter test name and description.
- Click on NEXT button and select service and operation in the next wizard
- 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>
- 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>
- Click on FINISH button. Now test1.xml file will look like this
- 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.
- 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>
- Click on OK button
- Final test case will look like below screenshot
- Go to Enterprise Console and select Unit Tests tab under the application
- Select test1.xml and click on Execute. Enter the details of test run
- Click on OK button. Result of test run window will open.
- 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.
Now we will check the failed test case.
- Change the Emulate payload to Hello Pele.<processResponse xmlns=”http://xmlns.oracle.com/BPELDemoApplication/HelloWorldBPEL/HWBPELProcess”><result>Hello Pele</result></processResponse>
- 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.
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 Plan
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.
After editing the configuration file validate this file. Right click on composite.xml and select Validate Config Plan
Finally attach this configuration plan during SOA composite deployment.
You can attach the configuration plan at EM console also while deploying SAR (Service Archive) into weblogic server.