7.3.  A quick Look at PDFUnit-XML

It is unnecessary for testers to know Java to write tests for PDF documents. With the name 'PDFUnit-XML' a version of PDFUnit exists for an XML-based system. It contains a runtime to execute the tests, scripts to start them, XML Schema to validate the tests and stylesheets as part of the runtime. 'PDFUnit-XML' is completely compatible with 'PDFUnit-Java'.

The following examples show the idea behind PDFUnit-XML:

<testcase name="hasTextOnSpecifiedPages_Containing">
  <assertThat testDocument="content/diverseContentOnMultiplePages.pdf">
    <hasText onPage="1, 2, 3" >
      <containing>Content on</containing>
<testcase name="hasTitle_MatchingRegex">
  <assertThat testDocument="documentInfo/documentInfo_allInfo.pdf">
      <startingWith>PDFUnit sample</startingWith>
<testcase name="compareText_InPageRegion">
  <assertThat testDocument="test/test.pdf"
    <haveSameText on="EVERY_PAGE" >
      <inRegion upperLeftX="50" upperLeftY="720" width="150" height="30" />
<testcase name="hasField_MultipleFields">
  <assertThat testDocument="acrofields/simpleRegistrationForm.pdf">
    <hasField withName="name" />
    <hasField withName="address" />
    <hasField withName="postal_code" />
    <hasField withName="email" />

Names of the tags and attributes are mostly the same as the function names in the Java-API. They also follow the idea of 'Fluent Interfaces' (http://de.wikipedia.org/wiki/Fluent_Interface).

XML Schema exists to validate the XML syntax.

A detailed description of PDFUnit-XML is available.