ActiveVOS Designer User’s Guide

Tips on Using Parameterized XSL for Input and Assert Data

You can build efficiency into your B-unit tests in cases where you want to assert a small difference in the same data across multiple tests. The efficiency comes in the form of parameterized XSL.

Consider the following example.

In an XML data file, there is the following element:

<ns:status>CREATED</ns:status>

Instead of creating different XML files, each with a different status value, you can write an XSL file such as:

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:ns="http://schemas.active-endpoints.com/b4p
     /wshumantask/2007/10/aeb4p-task-rt.xsd">      
   <xsl:import href="common.xsl"/>
   <xsl:param name="state"/>
   <xsl:template match="ns:status/text()" priority="2">
      <xsl:value-of select="$state" />
   </xsl:template>
</xsl:stylesheet>

In the Source view of your BUnit file, you can then add a parameter, such as:

<abu:part href="../data/getTaskInstanceResponse-minimal.xml"
   name="taskInstance" 
   xsl="../xsl/change-task-instance-state.xsl">
   <abu:params>
        <abu:param name="state" value="COMPLETED"/>
   </abu:params>

For each B-unit test, you use the same imported data and the same XSL file. You need only change the parameter value to get a different result.