phax/ph-schematron

ph-schematron-maven-plugin: Add support for testing/verifying Schematron validation failures

philippn opened this issue · 7 comments

Hiya,

this time it's more like a feature request.
My use case is I have a schematron and a bunch of test files (XML) for the rules inside of it. Some of the test files contain errors against the schematron to verify that it is working as intended. However, right now there is no way to use the maven plugin this way (i.e. it will fail the maven build if any errors occurred).

Because of that, I propose a new Maven config parameter failExpected with default value false.

  • if failExpected is false, the behaviour is the same as now
  • if failExpected is true, the build will fail if aFailedAsserts is empty

I hope you will find this a useful addition and I could also provide a patch for this if necessary.

Thanks in advance and kind regards,
Philipp

phax commented

Hi Philipp!
Good suggestion - thanks.
Your suggestion means, that the plugin is run with several Maven "executions".
Alternatively I could add some xmlErrorDirectory, xmlErrorIncludes and xmlErrorExcludes parameters, so that good and bad cases can be tested in a seingle execution (which might improve runtime because better caching of pre-compiled rules)...
BR, Philip

Hi Philip,
I think multiple executions would be fine. Performance should not be much of a problem because usually you will only have two executions for an arbitrary number of files to validate.

But of course the other solution would solve my problem as well. Thanks :-)

Kind regards,
Philipp

phax commented

What to do with the SVRL directory in the error case?
Shall I add an svrlErrorDirectory as well?

Since xmlErrorDirectory and xmlDirectory could potentially include the same filenames, it would probably need to be seperated too, yes.

phax commented

I chose to add the 'xmlErrorDirectory` version - SNAPSHOT -13 will be the first version to include it. Next is documentation.

Works great, many thanks! :-)

phax commented

Excellent :) - Thanks for testing!!!