Specifying Tests with DECOR
Contents
Making Test Specifications
DECOR allows the specification and generation of tests for messages and documents specified in DECOR; especially HL7 messages and documents.
Tests are specified by stating a simple condition which a message either conforms to or not. The test tooling can then test whether a message fulfills the test requirements. Test specs require an XML file called {my-project}-tests.xml, which will normally reside in apps/hl7 in eXist. Next we will describe the contents of {my-project}-tests.xml.
Content models are described in the following shorthand: X = {@a, @b?, c+, d*) meaning: element X contains 1 attribute a, optionally an attribute b, one or more elements c and zero or more elements d).
testset
This is the root element. It must contain @name.
<testset name="Colonoscopy report testset">
The content model of testset = {@name, release, test+}.
release
Must contain @uri, which points to an XML transactionDataset (a transaction in a dataset-like view) retrieved with the RetrieveTransaction function. Preferably an archived version from apps/decor/release, which is fulle specified (i.e. all terminologyAssociations present, all concepts linked to templates etc.).
<testset name="Colonoscopy report testset">
<release uri="http://decor.nictiz.nl/decor/services/RetrieveTransaction?id=2.16.840.1.113883.2.4.3.36.77.4.401&language=nl-NL&version=2014-04-25T12:07:09&format=xml"/>
Note:
- format must be 'xml'
- it should retrieve a transaction, not a dataset
- preferably the 'version' query parameter is used.
test
The content model of test = {@id?, @name, @transactionRef, @version?, name+, desc+, suppliedConcepts}
- @name is the identifier which is used in references
- @transactionRef must point to a transaction. It is used for retrieval of Xpaths for concepts.
suppliedConcepts
suppliedConcepts = {concept+}
concept
concepts occur in two forms:
concept = {@ref, @multiplicity}
This form will require the concept which @ref points to, to occur in the tested message the number of times @multiplicity states.
concept = {@ref, @occurrence, @assert}