| Version 2 (modified by jean-gui, 3 years ago) |
|---|
Tutorial on creating a new service
For a web service to be able to send results back to Unicorn, it needs to implement a specific format called an observation response. Basically, this is an XML document listing all the messages (errors, warnings and information) that the web service produced.
The following code is a very basic response resource showing the different message types. Each message has a type (info, warn, error), a context (optional) and a title. Each message element can have more data, like a longer text, an associated group, ... As you can see, there's also a status which is used to express if the test succeeded or failed. For a detailed description of this format check out its dedicated documentation.
<?xml version="1.0" encoding="UTF-8"?> <observationresponse xmlns="http://www.w3.org/2009/10/unicorn/observationresponse" xml:lang="en" ref="http://example.org/calc.txt"> <status value="failed" /> <message type="info"> <title>This is an informative message</title> <description>These messages appear under "Information" blocks in Unicorn's result page</description> </message> <message type="warning"> <context line="2">div a.test</context> <title>This is a warning</title> </message> <message type="error"> <context line="3">foo bar</context> <title>This is an error</title> </message> </observationresponse>
The complete XML schema for this format is available.
A tutorial composed of several responses is available directly through the development version of Unicorn. It takes the form of results from Unicorn using the special test task along with a set of response files. This special task allows developers to test their Unicorn output by submitting a response file and seeing how Unicorn displays them.
TODO: talk a bit about the contract (WADL file)
