Apache OpenOffice contains automated test suites that can be ran against the office. The test framework is written in Java and based on JUnit 4.
This trunk branch is now the primary test suite for the AOO41X and AOO42X branches as well and those branches may not contain the latest tests or modifications.
The test suite in main branches AOO41X and AOO42X can be ran against a normal installation of the office or a just built "installed" office.
This currently requires the user running the tests to have previously built the office from source as some required dependencies for compiling the tests are used from the office build artifacts located in main/solver
.
Primarily these dependencies are things the Java UNO jars like juh, jurt, ridl, and unoil and tools like javamaker, regmerge, and idlc.
This trunk branch has been updated to allow it to run "standalone" of an office build. The test suites in this branch do not require the user to have previously built the office. This test directory can also be copied to another location and used to test a builds of trunk, AOO41X, or AOO42X.
This README is documentation for using the test suites without requiring an office build environment or having built the office from source in any branch.
Apache Ant 1.10.x and Java JDK 1.8 are known to work. Windows platforms can use the 64-bit JDK even if OpenOffice has to use a 32-bit JRE.
When switching branches especially between AOO versions it's recommended to delete the jars in test/lib
which will make
sure you get the correct versions of JUnit and Hamcrest libraries for your build since the test build will try to use the jars that are present but download the correct version if not found.
When we refer to an "installed" type build this means that you have built OpenOffice from source using build
config flag --with-package-format="installed"
.
Compiling the tests now require an SDK to be included in the office directory layout. When compiling tests using an "installed" type build, the office and the SDK are in built into separate directories and need combined. One method is to copy them into the test directory layout.
If you have just built an "installed" build of the office you should have environment variables set you can use.
For example on my Linux machine my local OpenOffice source repo is /home/carl/dev-git/openoffice
and my variables are set like this:
SOURCE_ROOT_DIR=/home/carl/dev-git/openoffice
SRC_ROOT=/home/carl/dev-git/openoffice/main
INPATH=unxlngx6.pro
If you are using a new terminal you can run your environment setup script from main
like:
source ./LinuxX86-64Env.Set.sh
If you have not previously ran tests you may not have a testspace
directory under test
. If not create it:
mkdir $SOURCE_ROOT_DIR/test/testspace
And the directory for the office:
mkdir $SOURCE_ROOT_DIR/test/testspace/install
Now copy the "installed" office from the build location:
cp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice/installed/install/en-US/openoffice4 $SOURCE_ROOT_DIR/test/testspace/install/
Then copy the SDK into the office:
cp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice_SDK/installed/install/en-US/openoffice4/sdk $SOURCE_ROOT_DIR/test/testspace/install/openoffice4/
The tests are built using Ant and passing an openoffice.home
property with the location of the office needed for dependencies.
"installed" build example:
ant -Dopenoffice.home="$PWD/testspace/install/openoffice4" compile
Or an office in the standard Linux installation directory:
ant -Dopenoffice.home="/opt/openoffice4" compile
Or Windows
ant -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" compile
There are three test suites available. Build Verification Test (BVT), Function Verification Test (FVT), and Performance Verification Test (PVT).
The Build Verification Test Suite includes approximately fifty unit tests used for general build verification.
The Functional Verification Test Suite includes almost nine hundred unit tests to more thoroughly test the office features and UI.
Not all tests are ran for each platform.
BVT Example (Linux):
./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp bvt
BVT Example (Windows):
.\run.bat -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" -tp bvt
FVT Example:
./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp fvt
./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tc bvt.gui.BasicFunctionTest
./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tm bvt:bvt.gui.BasicFunctionTest.testFindFormulasAndValues
./run -help
By default, the testing output is stored in test/testspace/output.***
where *** is the test suite type.
- result.xml: Test result in HTML.
- result.html: Test result in XML.
- screenshot/: Screenshot pictures when test assert is failed.
Open test/testspace/output.***/result.html
in your browser to see the testing report.
Running clean will delete compiled classes and build directories.
ant clean
The test/testspace
directory, test results and "installed" office if used need to be manually deleted when no longer needed.