Norbert Hartl

mostly brackets and pipes

Simple XML Testsuite

Building REST interfaces became a frequent task in my daily work. I really like to stay within my smalltalk image (the world is good in here) but crossing the image boundary and spread some bits over the internet has this adventurous touch :)

Leaving the image means leaving the language as well. In order to speak a format that can be considered common there are roughly two alternatives these days: Json and XML. Json is fine for very simple stuff. It is smaller and looks nicer. But these are all of the advantages. I’m not a big fan of XML but I get the job done with it. Implementing a remote interface involves two sides and most of the time that means two parties. To avoid problems in communication early I like to write XML schema files.

It is a proper definition of the negotiated format and every party is able to test a format without the involvement of the counter-part. It often solved troubles for me because I can just validate a snippet of communicated data to state clearly whose fault it was if it doesn’t work (often it is not that easy that’s true).

Developing an XML schema file can be a rather complex thing to do. In Smalltalk I’m used to create some test cases to ease my work. But in XML schema it is not that comfortable. I need to test that a given format can be parsed and that the unwanted cases fail. To help me with that task I created a simple script that tries to behave like a testsuite does. In order to be able to reuse it I put it on a git server. Enough reasons to announce it in my blog. Some other people might find it useful.

You can find it on github