Thursday, February 6, 2020

12c SOA - Composites - Unit Test suites creation and run the test cases from console.

Topics covered:
  • Create, deploy, and run test cases that automate the testing of SOA composite applications.
Why Test Suites:
Test cases enable you to simulate the interaction between a SOA composite application and its web service partners before deployment in a production environment. This helps to ensure that a process interacts with web service partners as expected when it is ready for deployment to a production environment.

In this type of testing, wires, service binding components, service components (such as BPEL processes and Oracle Mediator service components), and reference binding components are tested.

Overview of Test Suites
Test suites consist of a logical collection of one or more test cases. Each test case contains a set of commands to perform as the test instance is executed. The execution of a test suite is known as a test run. 

Before starting let me explain you two basic terms that will be used while creating test cases. These are 
Assertions : You perform assertions to verify variable data or process flow. Assertions enable you to validate test data in an entire XML document as a process is executed. This is done by extracting a value and comparing it to an expected value.
Emulations: These are used to simulate the message data that your SOA composite application receives from web service partners.

Usecase:
I have created a sample SOA application having BPEL service exposed as web service and wired with DB adapter which is used to call a table that I have created.The input for this interface is a string variable and its value would be passed to the table as an input parameter by our BPEL process.In response it will return response based upon the input passed. Visit my previous blog for the steps 12c-soa-db-adapter-perform-select.

Below is the list of input and output that would be returned:
Input: EmpId
Output: EmpId EmpFName EmpFName DeptId DeptName EmpType

Test cases tested with the implementation:
  • Case1 -Tested with initiate Message + Assert Input to BPEL + Assert Input and output DB Adapter. Result: It will fetch the data from the DB table based on the assigned Input in the test case and validate with the assert output data. if they are matched, then it is passed with success. otherwise it is failed.
  • Case2 - Tested with initiate Message +  Assert Input to DB Adapter. Result: It will fetch the data from the DB table based on the assigned Input in the test case.
  • Case3 - Tested with initiate Message + Assert Input to BPEL + Emulate Output to DB Adapter. Result: It will fetch the data from the DB table based on the assigned Input in the test case. if Input is dummy or invalid, then it will send the emulate data as a output to the user.
Implementation:
In project explorer⇾navigate to "testsuites" then right click and click on "Create Test Suite".
 Give the test suite name and click ok.
 Another window will open up prompting for test case name.Give the test case name and click OK.
 Next
Input  Initiate Message - Generate Sample
 Provide the data.
 Test Output part - Generate Sample
 Provide the output data
 So the Test case is ready.
Deploy and run Test case 1 :






Now use only Initiate Input and Assert Input to the Adapter

 Deploy and run Test case 2 :
Now use Initiate Message + Assert Input to Adapter + Emulate Output from the adapter.





 Deploy and run Test case 3 :


In this way we can add any number of test cases to our SOA composite application and before deploying them to production we can test our composites functionality whether they are behaving in expecting manner or not.

No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...