Testing a Pattern

You can test the behavior of a pattern on a selected document, to detect potential errors in its structure.

Important: The following pattern elements are eligible for the test:
  • Resource pattern
  • Statement pattern
  • Regular expression
  • String match (literal)
  • Field capture (such as identifier, label, text, attribute value, link source or target...)


Before you begin: Open a pattern.
See Also
About Patterns
  1. From the context toolbar, click Debug to enter the debug mode.
  2. To define breakpoints on your pattern:
    1. Select an element in the pattern.
    2. From the context toolbar, click Breakpoint .
      Two symbols appear to indicate the breakpoint:
      • On the left of the element
      • In the left margin


      Tip: To remove the breakpoint, click Breakpoint . The symbols disappear.
      Important: If you do not add any breakpoint:
      • The test is performed on the whole document.
      • The result is computed for the whole document (failed or successful match), no detail is provided.
  3. From the tree, drag the document to be tested onto the dedicated box.

    • A context bar appears.
    • The source of the document is displayed.

  4. To perform a test on the eligible elements, click Play .
    The test is performed until the first breakpoint.

    As a result:

    • An additional context bar appears to enable navigation.
    • Circular symbols appear on the pattern elements:
      Symbol's color Description
      Green This pattern element matches with the document
      Red This pattern element does not match with the document
    • Two lists appear:
      List Description
      Stack For the pattern element where the test has paused (because of a breakpoint or when using the navigation commands), lists the pattern structure elements that are under analysis.
      Note: The stack list starts with the current element, goes on with the analyzed elements and ends with the entry element of the pattern. Compared to the graphical view, the direction of reading is reversed.
      Data When selecting a pattern element in the Stack list, displays the elements of the analyzed document that are under analysis.
      Tip: Select an element in one of these lists to display details in the properties area.


  5. To continue the test to the next eligible element, use the navigation commands:
    OptionDescription
    Step Into
    Runs the test and pauses at the next element to be analyzed.
    This command enables you to perform a step by step analysis.
    Step Over
    Runs the test and pauses at the next sibling element to be analyzed.
    This command skips the children of the current position.
    Important: The command does not pause at the children, but they are analyzed. If they do not match, the command moves back to the prior pattern element, and runs again to stop at the next element that can be explored.
    Step Out
    Runs the test and pauses at the next parent's sibling element to be analyzed.
    This command skips the children and siblings of the current position.
    Important: The command does not pause at the children and siblings, but they are analyzed. If they do not match, the command moves back to the prior pattern element, and runs again to stop at the next element that can be explored.
    In the graphical view, two arrows indicate where the test stops.
    • On the upper left corner of the element
    • In the left margin


  6. To remove the analyzed document, click Refresh . You can then test this pattern on another document.
  7. To exit the debug mode, click Debug .