Perform validation of XML files such as Oracle OSB files and Soap-UI test files

We are looking for a way in which we can perform XML file validations, in addition to schema validation. Found some links to Schematron, which looks interesting, but struggles to figure out how we can put all these things together:

Background problem

We are dealing with Oracle OSB, which simply generates a whole bunch of XML files. We also produce Soap-UI test packages for integration testing.

We have just begun to draw up our coding standards and recommendations for developers, which provides us with guidance on code reviews. However, many of these checks do believe that they can be automated. Very similar to how checkstyle can perform checks in our Java code.

For example, in our Soap-UI tests, we want to make sure that each soap request contains statements for Schema compliance and soap response. This "check" can be written as a fairly simple xpath.

Similar checks in our OSB produced XML, for example. that the variables correspond to the camelCase names, these resource paths do not apply to files outside the project, that there is top-level error handling.

The perfect solution

We have our maven builds, and soap-ui tests spill reliable formatted reports. We use jenkins as our CI server, and this allows us to select these reporting reports so that we can easily view the test results and see why the failures do not work.

We would like to find something that could perform these checks for us, and that they clearly write in jenkins.

The best I can find out so far:

  • Ask maven to run the ant task, which runs the test scheme
  • Find a way to translate circuit output to secure access output
  • Modify jenkins maven-runner to get a completion report.

But it seems to me that I'm stuck here rabbit hole. If this is the right way, I think someone else has already addressed this, but is struggling to find something useful in integrating the circuit with CI or maven tools.

Is a schematron considered?

Are there other tools that integrate more closely with our existing installation that is better suited?

+4
source share
2 answers

You can try using XmlUnit for such purposes.

In this scenario, you will record your checks in the form of JUnit tests. Simple XPath-based validations are easily performed using XmlUnit approval methods such as assertXpathExists , assertXpathsEqual , etc.

More sophisticated checks can be implemented using custom NodeTester .

+1
source

some Python code might help, as for a simple working example of Checkstyle with OSB see:

http://www.javamonamour.org/2013/07/lintcheckstyle-for-osb.html

I used Schematron in the past, it is just not flexible enough.

0
source

Source: https://habr.com/ru/post/1383535/


All Articles