Table of Contents

Search

  1. Preface
  2. Part 1: Using Process Developer
  3. Part 2: Creating and Modifying Processes
  4. Part 3: Functions, Events, Errors, and Correlation
  5. Part 4: Testing and Deployment
  6. Part 5: Process Central and Process Server (On-Premises)

Process Developer

Process Developer

Generating a Code Coverage Report

Generating a Code Coverage Report

Using a B-unit ant script, you can generate a code coverage report. The report tracks execution paths and display which activities were executed, expressed as percentage of activities executed at least once, in relation to all process's activities.
To generate a code coverage report:
  1. Create a B-unit ant script as described in Creating and Running a B-unit Ant Script.
  2. In the
    <target>
    named
    instrument
    , remove the comments and fill in a resource collection of bpel files. The following example show a simple resource collection:
    <target depends="init" name="instrument"> <!-- optional <coverage activitycoverage="true" linkcoverage="true" /> --> <bunit-instrument> <filelist> <file name="../bpel/myFile.bpel"/> </filelist> </bunit-instrument>
    By default, a code coverage report is generated for activities. If you want to include links, add the optional
    <coverage>
    element.
  3. In the target named
    test
    , uncomment the
    <engine properties>
    section.
  4. In the target named
    coverage report
    , do the following:
    • Provide a destination directory for your report.
    • Provide a report type. The types are HTML (default), XML (raw XML used to create HTML) or CONSOLE (writes summary results to the Ant Logger that you specify on the command line)
    • If you create a HTML report, you can add an xsltPath attribute.
    • Rename the filePrefix, if desired. The Ant project name is the default filePrefix. When you generate a report, the date and time are appended to the prefix.
  5. Run the B-unit ant script on the command line to generate the report. For example, in a command window, type
    ant -f filename.ant.xml
    .
What the Code Coverage Report Shows
  • Activity Coverage (default coverage): the total number of activities executed at least once over the total number of activities in the process.
  • Link Coverage (optional): the total number of activities that evaluated to true plus those that evaluated to false over the 2x total number of links with conditions.
    (totalTrue + totalFalse) / (totalLinksWithConditions *2).
    This ensures that the unit tests cover the execution of links completely because each link with a condition can evaluate to true or false.
Adding Code Coverage to an Existing B-Unit Ant Script
If you have an existing B-unit ant script, you can add code coverage to it just by putting in the correct ant tasks in the B-unit ant script.
  • Register the following typedefs in your Ant script and note that the attribute
    loaderref
    is set to
    bunit
    . This attribute must be set in order for all the Ant tasks to use the same classloader. The value of the attribute is unimportant as long as the value for all three typedefs match:
    <typedef classname="com.activee.ant.bunit.tasks.AeBUnitTask" loaderref="bunit" classpathref="bunit.classpath" name="bunit"/> <typedef classname="com.activee.ant.bunit.coverage.AeBUnitInstrumentTask" loaderref="bunit" classpathref="bunit.classpath" name="bunit-instrument"/> <typedef classname="com.activee.ant.bunit.coverage.AeBUnitCoverageReportTask" loaderref="bunit" classpathref="bunit.classpath" name="bunit-report"/>
  • Instrument your processes that are part of code coverage:
    <bunit-instrument> <coverage activitycoverage="true" linkcoverage="true" /> <filelist> <file name="../bpel/myBEPL.bpel"/> </filelist> </bunit-instrument>
  • Add the following engine property to the B-unit task that will execute the B-unit tests as follows:
    <bunit processLogging="urn:ae:full" trace="on"> <engineProperties> <engineProperty name="CustomManagers/AeBUnitCoverageManager/Class" value="com.activee.rt.bunit.coverage.AeBUnitCoverageManager"/> </engineProperties> <filelist> <file name="CancelTO.bunit"/> <file name="CreateTO.bunit"/> <file name="SubmitPO_UNI.bunit"/> <file name="SubmitUNIPO_AIFallOut.bunit"/> </filelist> </bunit>
  • Finally, you will need to output the report using the bunit-report Ant task:
    <bunit-report reportType="HTML" destdir="/Users/User1/Downloads/bunit/html" />
    For details on the parameters you can use for the B-unit report task (filePrefix, xsltPath, destDir, and reportType, see
    Step Four
    in the above procedure.

0 COMMENTS

We’d like to hear from you!