asam-ev / qc-framework

Mozilla Public License 2.0
13 stars 6 forks source link

Replace file based tests with xml validation #59

Closed romanodanilo closed 1 month ago

romanodanilo commented 1 month ago

Description

Before this PR some testing function were based on file equality: A test executes a command -> the command generates a file -> the generated file is checked to be 1 to 1 equal to a reference file provided

This makes the testing less general, as everytime the result xsd schema is updated, all the reference files needs to be updated as well

The PR replace those 4 tests with checking that the generated file follows the xsd schema defined here in doc/schema folder

To do so:

Moreover the new testing approach will be based on testing the properties of the output file. The first test of this approach is already included in the PR in the cTesterExampleCheckerBundle, CmdConfigContainsIssue test. This checks if the result file contains the Issue tag

How was the PR tested?

  1. Build and ran all tests, worked as expected. 4 Tests failing

Notes

Adding the xsd checks makes 4 tests failing

3 of the fails for the same reason, when performing xsd check it is raised

Error: element 'Issue' is not allowed for content model '(Locations+)'

This is because the generated xml do not specify the Locations attribute which is required in current xsd as it is specified with minOccurs="1"

The 4 test fails for the same reason but on a different tag

Error: element 'CheckerResults' is not allowed for content model '(CheckerBundle+)'

Since the result XML is

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CheckerResults version="1.0.0"/>

but CheckerBundle inside CheckerResults has minOccurs=1 as well