README.md
1# Apache OpenOffice<sup>®</sup> Test
2Apache OpenOffice contains automated test suites that can be ran against the office. The test framework is written in **Java** and based on **JUnit 4**.
3
4This **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.
5
6The test suite in main branches **AOO41X** and **AOO42X** can be ran against a normal installation of the office or a just built "installed" office.
7
8This 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`.
9Primarily these dependencies are things the Java UNO jars like juh, jurt, ridl, and unoil and tools like javamaker, regmerge, and idlc.
10
11This **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**.
12
13This README is documentation for using the test suites without requiring an office build environment or having built the office from source in any branch.
14
15## Prerequisites
16
17Apache 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.
18
19## Caution
20When switching branches especially between AOO versions it's recommended to delete the jars in `test/lib` which will make
21sure 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.
22
23## Installed Type Build Setup
24When we refer to an "installed" type build this means that you have built OpenOffice from source using build
25config flag `--with-package-format="installed"`.
26
27Compiling the tests now require an SDK to be included in the office directory layout. When compiling tests using an "installed"
28type build, the office and the SDK are in built into separate directories and need combined. One method is to copy them into
29the test directory layout.
30
31If you have just built an "installed" build of the office you should have environment variables set you can use.
32For example on my Linux machine my local OpenOffice source repo is `/home/carl/dev-git/openoffice` and my variables are set like this:
33```shell
34SOURCE_ROOT_DIR=/home/carl/dev-git/openoffice
35SRC_ROOT=/home/carl/dev-git/openoffice/main
36INPATH=unxlngx6.pro
37```
38
39If you are using a new terminal you can run your environment setup script from `main` like:
40```shell
41source ./LinuxX86-64Env.Set.sh
42```
43
44If you have not previously ran tests you may not have a `testspace` directory under `test`. If not create it:
45```shell
46mkdir $SOURCE_ROOT_DIR/test/testspace
47```
48
49And the directory for the office:
50```shell
51mkdir $SOURCE_ROOT_DIR/test/testspace/install
52```
53
54Now copy the "installed" office from the build location:
55```shell
56cp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice/installed/install/en-US/openoffice4 $SOURCE_ROOT_DIR/test/testspace/install/
57```
58
59Then copy the SDK into the office:
60```shell
61cp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice_SDK/installed/install/en-US/openoffice4/sdk $SOURCE_ROOT_DIR/test/testspace/install/openoffice4/
62```
63## Compiling the Tests
64The tests are built using Ant and passing an `openoffice.home` property with the location of the office needed for dependencies.
65
66"installed" build example:
67```shell
68ant -Dopenoffice.home="$PWD/testspace/install/openoffice4" compile
69```
70Or an office in the standard Linux installation directory:
71```shell
72ant -Dopenoffice.home="/opt/openoffice4" compile
73```
74Or Windows
75```shell
76ant -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" compile
77```
78
79## Running Tests
80There are three test suites available. Build Verification Test (BVT), Function Verification Test (FVT), and Performance Verification Test (PVT).
81
82The **Build Verification Test** Suite includes approximately fifty unit tests used for general build verification.
83
84The **Functional Verification Test** Suite includes almost nine hundred unit tests to more thoroughly test the office features and UI.
85_Not all tests are ran for each platform._
86
87### Running a Complete Test Suite
88BVT Example (Linux):
89```shell
90./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp bvt
91```
92BVT Example (Windows):
93```shell
94.\run.bat -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" -tp bvt
95```
96FVT Example:
97```shell
98./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp fvt
99```
100### Running a Single Class
101```shell
102./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tc bvt.gui.BasicFunctionTest
103```
104### Running a Single Test Method
105```shell
106./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tm bvt:bvt.gui.BasicFunctionTest.testFindFormulasAndValues
107```
108### Run Help
109```shell
110./run -help
111```
112
113## Test Results
114By default, the testing output is stored in `test/testspace/output.***` where *** is the test suite type.
115
116* result.xml: Test result in HTML.
117* result.html: Test result in XML.
118* screenshot/: Screenshot pictures when test assert is failed.
119
120Open `test/testspace/output.***/result.html` in your browser to see the testing report.
121
122## Cleaning Up
123Running clean will delete compiled classes and build directories.
124```shell
125ant clean
126```
127The `test/testspace` directory, test results and "installed" office if used need to be manually deleted when no longer needed.
128