WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

XUnit Assertion Library

xml:xspec provides an XUnit assertion library, which can be imported to an XUnit testlist with...

<import>res:/org/netkernel/xml/xspec/assertLibrary.xml</import>

This provides the following assertions...

<xspecPassed />

and

<xspecFailed />

The assertions will happily take either XML or HTML formatted results from either of the active:xspecXXXX endpoints.

Using XSpec suite with XUnit

Just call the active:xspecXML from your tests and assert . Below shows an example which runs the provided escape-for-regex.xspec which comes with XSpec.

<testlist>
  <import>res:/org/netkernel/xml/xspec/assertLibrary.xml</import>
  <test name="active:xspecXML - Jeni's escape-for-regex example">
    <request>
      <identifier>active:xspecXML</identifier>
      <argument name="operator">res:/resources/test/escape-for-regex/escape-for-regex.xspec</argument>
    </request>
    <assert>
      <notNull />
      <mimetype>text/xml</mimetype>
      <xspecFailed />
      < !--This is Jeni's demo and it is supposed to show failure -->
    </assert>
  </test>
  <test name="active:xspecXML - Jeni's escape-for-regex example FIXED">
    <request>
      <identifier>active:xspecXML</identifier>
      <argument name="operator">res:/resources/test/escape-for-regex/escape-for-regex-FIXED.xspec</argument>
    </request>
    <assert>
      <notNull />
      <mimetype>text/xml</mimetype>
      <xspecPassed />
    </assert>
  </test>
  <test name="active:xspecHTML - Jeni's escape-for-regex example FIXED">
    <request>
      <identifier>active:xspecHTML</identifier>
      <argument name="operator">res:/resources/test/escape-for-regex/escape-for-regex-FIXED.xspec</argument>
    </request>
    <assert>
      <notNull />
      <mimetype>text/html</mimetype>
      <xspecPassed />
    </assert>
  </test>
</testlist>