In a previous post, I blogged about how to use this API and I wanted to experiment more with it. I built a small Java program that has this basic flow:
- Start the program by supplying the name of the SOA composite application along with the version number and partition which are both optional parameters.
- Use the Fusion Java API to retrieve the source code for any BPEL processes defined in the composite and parse the source code to retrieve the names of each BPEL activity or step.
- Use the Fusion Java API to retrieve all instances where this composite has been executed and parse the instance audit trail to retrieve the names of each BPEL activity that has been executed.
- Compare these two lists to determine which activities have not yet been tested. This is technically referred to as "Statement Coverage".
Example
To test the coverage analysis, I created a simple SOA composite named CoverageTest1 with a BPEL process that has an IF activity as shown below.
BPEL source code:
<if name="If1">
<condition>1=1</condition>
<assign name="Assign1">
<copy>
<from>"value1"</from>
<to>$outputVariable.payload/client:result</to>
</copy>
</assign>
<else>
<assign name="Assign2">
<copy>
<from>"value2"</from>
<to>$outputVariable.payload/client:result</to>
</copy>
</assign>
</else>
</if>
<condition>1=1</condition>
<assign name="Assign1">
<copy>
<from>"value1"</from>
<to>$outputVariable.payload/client:result</to>
</copy>
</assign>
<else>
<assign name="Assign2">
<copy>
<from>"value2"</from>
<to>$outputVariable.payload/client:result</to>
</copy>
</assign>
</else>
</if>
Note that the condition "1=1" will always return true, so that the ELSE activities will never be executed.
When I run the CoverageAnalyzer.java code from JDeveloper, I get the following response:
Step Assign2 has not been tested
Coverage for composite CoverageTest1 is not complete
This is very interesting. I remember this was available out of the box in 10g platform. Looks like they drop the ball in 11g. I don;t see the link for the sample code. Could you please make it available or email me @ techypiyush@gmail.com
ReplyDelete