Skip to main content

Test annotation notes...

No replies
bkurotsu
Offline
Joined: 2004-12-13

The request was to add the ability to add notes and other tagging to test result after the test has completed (and even after the test has run or test run has completed).

As a solution without altering the integrity of the result data, an annotation system is now available. It is a programmatic interface, which can be tied to user interface or custom code as desired. The annotations are stored in the work directory on disk and can be retrieved or altered as needed.

The WorkDirectory object own the data and has the accessor methods.

WorkDirectory.putTestAnnotation(TestResult, String, String)

This method allows you to add annotations. The data is a key-value pair. Any number of pairs can be added for any test. The namespace for the keys is unique to each test, so no special prefixing or encoding is required. If the second string is null, it indicates that the item should be removed from the map. An empty string can be used in this position if the value needs to be empty.

WorkDirectory.getTestAnnotation(TestResult) returns a Map. It contains the key-value pairs that were previously added for a test. Null is returned to indicate that no annotations exist for that test.

On top of this functionality, the XML report will also export the data when it comes time. It is added to each section as needed, as shown below:

This is consistent with how the other (existing) test property section are formatted. Currently the value is not formatted as CDATA - it might be necessary to change it to do this instead.