An expected text and actual text on a PDF page can be compared using the following tags:
<!-- Comparing text: --> <startingWith /> <containing /> <matchingComplete /> <matchingRegex /> <endingWith /> <notStartingWith /> <notContaining /> <notMatchingRegex /> <notEndingWith /> <containing whitespaces=".." /> <matchingComplete whitespaces=".." /> <notContaining whitespaces=".." />
Tests without the second parameter normalize the whitespaces. That means whitespaces at the beginning and the end are removed and all sequences of any whitespace within a text are reduced to one space. |
|
Use the optional attribute |
Comparisons with regular expressions follow the rules and possibilities of the class
java.util.regex.Pattern
:
<!-- Using regular expression to compare page content: --> <testcase name="hasText_MatchingRegex"> <assertThat testDocument="content/diverseContentOnMultiplePages.pdf"> <hasText on="FIRST_PAGE"> <matchingRegex>.*[Cc]ontent.*</matchingRegex> </hasText> </assertThat> </testcase>