Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Fix failing XML validation tests #65

Closed
anweiss opened this issue Jan 24, 2019 · 4 comments
Closed

Fix failing XML validation tests #65

anweiss opened this issue Jan 24, 2019 · 4 comments
Labels
test Unit, functional and end-to-end testing
Milestone

Comments

@anweiss
Copy link
Contributor

anweiss commented Jan 24, 2019

The following tests are failing:

--- FAIL: TestXMLValidate (0.00s)
    --- FAIL: TestXMLValidate/successful-validation (0.00s)
        validator_test.go:159: xmlValidator.Validate() error = open ../testdata/fedramp-simple-profile.xml: no such file or directory, wantErr false
    --- PASS: TestXMLValidate/failed-validation (0.00s)

Looks like we need to include some test data for validation against the upstream XSDs

Supports #10

@anweiss anweiss added the test Unit, functional and end-to-end testing label Jan 24, 2019
@anweiss anweiss added this to the OSCAL 1.0 milestone Jan 24, 2019
@farhankamalkhan-10p
Copy link
Contributor

@anweiss I have included some profiles and schema in test_util/artifacts and changed the validator test to use those. This fixed the issue mentioned above but now the test gives a new error on TestXMLValidate/successful-validation in the PR #72. The error is as following:

time="2019-01-28T17:35:26+05:00" level=error msg="../test_util/artifacts/oscal-profile-schema.xsd:323: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': A global element declaration '{http://csrc.nist.gov/ns/oscal/1.0}group' does already exist.\n../test_util/artifacts/oscal-profile-schema.xsd:336: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://csrc.nist.gov/ns/oscal/1.0}control' does not resolve to a(n) element declaration.\n../test_util/artifacts/oscal-profile-schema.xsd:394: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://csrc.nist.gov/ns/oscal/1.0}guideline' does not resolve to a(n) element declaration.\n../test_util/artifacts/oscal-profile-schema.xsd:475: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://csrc.nist.gov/ns/oscal/1.0}choice' does not resolve to a(n) element declaration.\n../test_util/artifacts/oscal-profile-schema.xsd:545: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://csrc.nist.gov/ns/oscal/1.0}ref' does not resolve to a(n) element declaration.\nWXS schema ../test_util/artifacts/oscal-profile-schema.xsd failed to compile\n"

Can this be because of the discrepancies in the profile schema? I am not sure how to go forward and solve this issue. Can you please look into this.

@anweiss
Copy link
Contributor Author

anweiss commented Jan 28, 2019

@farhan-khan30 I'm not seeing this error. The test looked to pass in your PR.

@farhankamalkhan-10p
Copy link
Contributor

Yep logs look clean on the PR. I was probably missing an artifact on my local machine.

@anweiss
Copy link
Contributor Author

anweiss commented Jan 29, 2019

No worries. Closing.

@anweiss anweiss closed this as completed Jan 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
test Unit, functional and end-to-end testing
Projects
None yet
Development

No branches or pull requests

2 participants