MEN XML Checker Plugin - Asserts


‘file.xml’ is ‘valid’

What ?

This assertion verifies if a xml file is valid. If the assertion is verified the test continues, else the test fails.

ASSERT {resourceToAssert<Res:xml>} IS valid

> Input :

  • {resourceToAssert<Res:xml>} : The name of the resource to assert (xml type resource).

Example :

LOAD schema.xsd AS schema-resource.file

LOAD sample.xml AS sample-resource.file

CONVERT sample-resource.file TO file (param.relativedate) AS sample-resource-relative-date.file

CONVERT sample-resource-relative-date.file TO xml (structured) AS sample-resource-relative-date.xml

ASSERT sample-resource-relative-date.xml IS valid USING schema-resource.file



‘file1.xml’ is ‘similaire’ with ‘file2.xml’

What ?

This assertion verifies if a xml file matches another xml file. If the assertion is verified the test continues, else the test fails.

ASSERT {resourceToAssert<Res:xml>} IS similaire WITH {resourceToCompareTo<Res:xml>} USING {config}

> Input :

  • {resourceToAssert<Res:xml>} : The name of the resource to assert (xml type resource).
  • {resourceToCompareTo<Res:xml>} : The name of the resource to compare to (xml type resource).
  • {config} : The name of the loaded configuration resource (file type resource). It can be used to change the default comparison engine from jaxb to xmlunit, through a ‘comparateur:xmlunit’ entry. The defalut comparator can also be changed directly with $(comparateur:xmlunit). A xsd resource can be specified here if using the jaxb comparator.

Example :

LOAD actual.xml AS actual-resource.file

CONVERT actual-resource.file TO xml (structured) AS actual-resource.xml

LOAD expected.xml AS expected-resource.file

CONVERT expected-resource.file TO file (param.relativedate) AS expected-resource-relative-date.file

CONVERT expected-resource-relative-date.file TO xml (structured) AS expected-resource-relative-date.xml

ASSERT actual-resource.xml IS similaire WITH expected-resource-relative-date.xml USING $(comparateur:xmlunit)