|
|
last change: $Date: 2006/10/06 10:39:56 $ $Revision: 1.7 $ ConvWatchConvWatch is a test tool to compare documents not by it's content but by it's graphical
representation. It's based on Caolán McNamara's convwatch tool written in Python. Due to some limitations
ConvWatch has been completely rewritten in Java. Topics
Dependencies
How ConvWatch workConvWatch loads a set of documents and
The saved tests ensures no regression against the reference output documents. The print tests determine if there are differences against the reference printer output (which could either be created by OpenOffice.org originally so as to test for layout regressions, or by Microsoft Office so as to compare conversion quality or by PDF export from OpenOffice.org) To make the print tests valid all printing must happen with the same printer driver (and the same set of fonts, but we'll overlook that issue here). Some additional software is required to facilitate the comparison. ConvWatch is a part of the qadevOOo environment. It's written in Java which is good for communication with OpenOffice.org. So install as follows...InstallingSome software is required to run ConvWatch and have to be installed locally.
Complex testConvWatch is realized as a complex test. This complex test environment is be able to open/start an already installed OpenOffice.org, also close this opened OpenOffice.org and some more for automatically test runs.Only one extra property file is need. Property FileTo control the ConvWatch process, there must exist a property file. Lines starts with '#' are comments. Empty lines are allowed. In this property file the information stored, where to find the documents, where to find the references and where have to go the results. It also contains the call to a OpenOffice.org executable. The variables will describe here. DOC_COMPARATOR_INPUT_PATH=/path/to/document-pool DOC_COMPARATOR_REFERENCE_PATH=/path/to/references DOC_COMPARATOR_OUTPUT_PATH=/path/to/convwatch_results AppExecutionCommand=/opt/openoffice2/program/soffice -headless -norestore -nocrashreport -accept=socket,host=localhost,port=8100;urp; EnhancementsDue to the fact, that ConvWatch works within Microsoft Windows or Unix environment, but there
are different path variables to set, there exist a variable prefix. This prefix
based on 7 characters, wntmsci, unxlngi, unxsols or
unxsoli, but doesn't need to set.
So instead of DOC_COMPARATOR_INPUT_PATH use
unxlngi.DOC_COMPARATOR_INPUT_PATH or wntmsci.DOC_COMPARATOR_INPUT_PATH or
unxsols.DOC_COMPARATOR_INPUT_PATH so there must only exist one property file for all
environments.
At the moment the variables must exist in the property file from the Java file, there are other ways to manipulate such variables like shell paramater or environment variables but this described method is to favour. The first three variables are the most important, and must set, the other variables are optional.
The default value is 212. So a DIN A4 document results in 1752x2478 pixel sized picture which consume round about 17MB memory. IMPORTANT If Java fails with memory problems it could be that a special Java parameter has to set . Search the line where Java is called and insert -Xmx128m. Start again, maybe the value 128 isn't high enough. As default the parameter is not used. Set DOC_COMPARATOR_REFERENCE_PATH to the location of the reference documents. If this variable isn't set ConvWatch assume the reference exists near the original document file. For this the behaviour the DOC_COMPARATOR_INPUT_PATH must be writable. Set DOC_COMPARATOR_REFERENCE_CREATOR_TYPE=pdf
the internal PDF creator from OpenOffice.org is taken. Set DOC_COMPARATOR_REFERENCE_CREATOR_TYPE=msoffice not
OpenOffice.org creates the output, but Microsoft Office. There must exist a runnable Microsoft Office
on this PC and this works only in Microsoft Windows environment. The default, if not set is OOo for OpenOffice.org output. Start ConvWatchJust a little tsch helper script, copy the OOoRunnerLight.jar out of the qadevOOo project, the other jar files, get out from an current OpenOffice.org program/classes directory.
#!/bin/tcsh
setenv PTO /path/to/an/office/program
# path to open office classes
setenv PTOC ${PTO}/classes
# path to OOoRunnerLight.jar
setenv OOORUNNER /path/to/OOoRunnerLight
setenv JARFILES ${PTOC}/ridl.jar:${PTOC}/unoil.jar:${PTOC}/jurt.jar:${PTOC}/juh.jar:\
${PTOC}/jut.jar:${PTOC}/java_uno.jar:${OOORUNNER}/OOoRunnerLight.jar
# start reference build
java -cp ${JARFILES} org.openoffice.Runner -tb java_complex -ini propertyfile.ini -o convwatch.ReferenceBuilder
# start the graphical document compare
java -cp ${JARFILES} org.openoffice.Runner -tb java_complex -ini propertyfile.ini -o convwatch.ConvWatchStarter
Start the test by simply call this script. Only set the path to the right places. With this script at first the references will build. As second, the OK, the result should never fail but should only demonstrate how ConvWatch works. Now think about the way to only create references with an old OpenOffice.org 1.0.x and make a graphically compare to a new OpenOffice.org 2.0. not only with one document in the pool. But be aware, the run could take hours. ResultsUse a image viewer to examine the results which will be found in the DOC_COMPARATOR_OUTPUT_PATH of the property file. There exist at least 3 JPEG pictures and one PostScript *.ps file. All based on the document name and some appendix which are described as follows.
It's possible that there exist much more files, for every document page at least the 3 JPEG pictures. The ini result file in short, contains at least two sections, the global section
The page sections, for every page exist a own section.
TipsIf in the Unix environment the PostScript file is only create in black and white, create a new printer which produce color output and set it as the default printer. Now the output should came also in color. Create ReferencesIt is possible to create the reference files *.prn automatically. The references have to build only once and rebuild only if there are changes like a new office major version. Java APIThere exist also a possibility to use ConvWatch direct from a Java environment. But, be aware, this is absolutly alpha state, not tested right and in a strong changeable way. To take a look, get qadevOOo project, goto directory runner/convwatch open the Java file GraphicalDifferenceTest.java and read it's comments. There will be create a javadoc documentation about the API in the near future. If there are problems/ideas with running ConvWatch don't hesitate to contact the current game keeper. Thanks
|



