How to write an ODF test
Each computer program has limitations. Many software that can open ODF files does not understand the all information in the file. If you open a file and save it again, information may be lost. This is true for most file formats and most software.
To fix this issue, the Autotests site manages tests that check if information is lost or corrupted.
You can write your own test on this site to test if the information is preserved.
For example, you want to know if paragraphs are preserved, you can create a simple test to check that the ODF paragraph code
<text:p> is preserved after processing in an application.
In the example below, we will create a test file with one paragraph. Then we add a test expression (XPath) to count the number of paragraphs in the file. If, after processing, the number of paragraphs is not one, there is a bug in the software.
These are the steps to building a test using the Autotests framework.
Step 1: create an account and log in
To use the Autotest server, you need an account. You can register your email address here and you will receive an email to set your password and log in. Once you have this, continue to step 2.
Step 2: choose a template file
Then click on 'make test' to start writing your own test on this file. Note: The file size is limited to 2Mb
Alternative short cut - quick test
The quickest way to create the test is to click on one of these links which will create a test from a pre-configured simple template:
Step 3: Name your test and create some XML
Give your test a name - think of what you are testing for, then add some content:
Type some XML into the XML field. This XML will be inserted into the file that you chose as a starting point.
The editor knows what good XML looks like so will help you to type the right XML as you go.
Step 4: write the test
Now we come to the point where you write your actual test.
In this example, we want to make sure that there is still one paragraph in the document after processing and we will use an XPath expression to evaluate this automatically.
These can often be very simple test, for example, to count the number of paragraphs you can write
count(//text:p). So the check becomes
Press 'check test' to see if your XPath expression is correct - you will not be able to submit the test if the expression is not correct.
If it is good, you can save the test or add further XPath expressions.
Step 5: save your test
When you press 'save test' the test is saved and the information page for the test is loaded. Your test has now been queued for processing by all available factories.
This page also shows test results so after a minute, press 'reload' in your browser to show new results. Depending on workload, some results can take a few minutes to be returned.
If you want to refine your test, clone it and make it better.