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