-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit and regression testing for schemas and tools #153
Comments
@wendellpiez is the plan to use Saxon-HE to execute all of the transformations from the CLI? Otherwise, I don't know of any other CLI tools that fully conform to XSLT 3.0 and XPath 3.1 |
@anweiss , yes, Saxon-HE is an informal reference implementation for the W3C Recs and developed by the editor of the spec. There are other XSLT 3.0 processors but as you say they are not complete or as accessible. Saxon is available in both Java and C. BTW this Issue should have been referenced by #186 -- |
Ok cool. It’s what I’ve been using on my side for running the transformations and XSpec tests so was just confirming. |
Hey @wendellpiez, is there a way to execute a transformation using the CLI to achieve the same mocking context behavior that one gets with XSpec
which returns the following error:
Instead, I have to create a more complete XML artifact as follows in order to get it to work:
which returns the following, as expected: {"title":"Three Controls from SP800-53"} I ask because I want to make sure the feature tests on the JavaScript side via the Saxon CLI are executing using the same context as in XSpec. |
@wendellpiez you can take a look at how this is coming together at https://github.com/anweiss/OSCAL/blob/json-tests/lib/XML-JSON/test/features/produce_json_from_xml.feature. The actual implementation of the test in JavaScript is at https://github.com/anweiss/OSCAL/blob/json-tests/lib/XML-JSON/test/features/step_definitions/produce_json_from_xml_stepdefs.js. It's actually pretty straight forward: run the transformation through Saxon, run a I'm simply working off of your |
@anweiss there is also a "mode" often given on the XSpec context, which indicates a mode of operation to the stylesheet. The mode can also be set on the Saxon CL as IIRC 'initial-mode' or some such. For example, in this case the mode might be "xml2json" (effectively the default mode of this XSLT, but made explicit to facilitate calling this logic from other stylesheets without clashing). I am not sure that will solve the problem but it might help. It is awesome that you are able to replicate the functionality on the JSON side, that is killer. (And that testing spec is sooo pretty.) |
June 21 Status: Per previous comments, JSON unit tests are being developed in a feature branch, |
We have been working on JSON schema generation unit tests in PR #464. This is a start of a long-running epic. |
User Story:
As an OSCAL developer, I have access to unit testing and regression testing to ensure and show my code is correct. As a stakeholder, I can examine these unit tests to see what is going on.
Goals:
Dependencies:
Acceptance Criteria
Hints
For schemas, a test suite of canonical samples can ensure compatibility going forward. Backward-incompatible changes can be planned and samples updated accordingly.
For Schematron and XSLT, the state of the art for unit and regression testing is XSpec: https://github.com/xspec/xspec
The text was updated successfully, but these errors were encountered: