XMLDiff

XMLDiff tests compare XML output(s) for the test to a reference in the specified gold_dir folder.

Options

Test configuration options are added to the tests file.

  • xmldiff: A list of XML files to compare

  • gold_dir: The directory where the "gold standard" files reside relative to the TEST_DIR: (default: ./gold/)

  • abs_zero: Absolute zero cutoff used in xmldiff comparisons, defaults to 1e-10

  • rel_err: Relative error value used in xmldiff comparisons, defaults to 5.5e-6

  • ignored_attributes: Ignore an attribute. For example, type and version in sample XML block below

<VTKFile type="Foo" version="0.1">

Other test commands & restrictions may be found in the TestHarness documentation.

Example test configuration in the MOOSE test suite

In this example, the XMLDiff tester is used to check the XML output of two VectorPostprocessors.

[Tests]
  issues = '#14634'
  design = 'XMLOutput.md'
  [parallel]
    requirement = "The system shall support XML output for vector data that is"

    [replicated]
      type = XMLDiff
      input = xml.i
      xmldiff = xml_out.xml
      min_parallel = 3
      max_parallel = 3

      detail = "replicated or "
    []
    [distributed]
      type = XMLDiff
      input = xml.i
      cli_args = 'VectorPostprocessors/distributed/parallel_type=DISTRIBUTED Outputs/file_base=xml_distributed_out'
      xmldiff = 'xml_distributed_out.xml xml_distributed_out.xml.1 xml_distributed_out.xml.2'
      min_parallel = 3
      max_parallel = 3

      detail = "distributed in parallel."
    []
  []

  [iterations]
    requirement = "The system shall support XML output for vector data during nonlinear solve."

    type = CheckFiles
    input = xml_iterations.i
    check_files = xml_iterations_out.xml
    file_expect_out = 'linear_iteration="1" nonlinear_iteration="0"'
  []
[]
(test/tests/outputs/xml/tests)