1*2ab0ece2SJohn Bampton<!-- 2*2ab0ece2SJohn Bampton Licensed to the Apache Software Foundation (ASF) under one 3*2ab0ece2SJohn Bampton or more contributor license agreements. See the NOTICE file 4*2ab0ece2SJohn Bampton distributed with this work for additional information 5*2ab0ece2SJohn Bampton regarding copyright ownership. The ASF licenses this file 6*2ab0ece2SJohn Bampton to you under the Apache License, Version 2.0 (the 7*2ab0ece2SJohn Bampton "License"); you may not use this file except in compliance 8*2ab0ece2SJohn Bampton with the License. You may obtain a copy of the License at 9*2ab0ece2SJohn Bampton 10*2ab0ece2SJohn Bampton http://www.apache.org/licenses/LICENSE-2.0 11*2ab0ece2SJohn Bampton 12*2ab0ece2SJohn Bampton Unless required by applicable law or agreed to in writing, 13*2ab0ece2SJohn Bampton software distributed under the License is distributed on an 14*2ab0ece2SJohn Bampton "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15*2ab0ece2SJohn Bampton KIND, either express or implied. See the License for the 16*2ab0ece2SJohn Bampton specific language governing permissions and limitations 17*2ab0ece2SJohn Bampton under the License. 18*2ab0ece2SJohn Bampton--> 19*2ab0ece2SJohn Bampton 20499ab82aSCarl Marcum# Apache OpenOffice<sup>®</sup> Test 21a7f3bf48SJohn Bampton 22983dd2d9SCarl MarcumApache OpenOffice contains automated test suites that can be ran against the office. The test framework is written in **Java** and based on **JUnit 4**. 23499ab82aSCarl Marcum 24983dd2d9SCarl MarcumThis **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. 25499ab82aSCarl Marcum 2605f6192cSCarl MarcumThe test suite in main branches **AOO41X** and **AOO42X** can be ran against a normal installation of the office or a just built "installed" office. 2705f6192cSCarl Marcum 28983dd2d9SCarl MarcumThis 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`. 29983dd2d9SCarl MarcumPrimarily these dependencies are things the Java UNO jars like juh, jurt, ridl, and unoil and tools like javamaker, regmerge, and idlc. 30983dd2d9SCarl Marcum 31983dd2d9SCarl MarcumThis **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**. 32983dd2d9SCarl Marcum 33983dd2d9SCarl MarcumThis README is documentation for using the test suites without requiring an office build environment or having built the office from source in any branch. 34499ab82aSCarl Marcum 35bc6c8f65SCarl Marcum## Prerequisites 36bc6c8f65SCarl Marcum 37bc6c8f65SCarl MarcumApache 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. 38bc6c8f65SCarl Marcum 39499ab82aSCarl Marcum## Caution 40a7f3bf48SJohn Bampton 41499ab82aSCarl MarcumWhen switching branches especially between AOO versions it's recommended to delete the jars in `test/lib` which will make 42499ab82aSCarl Marcumsure 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. 43499ab82aSCarl Marcum 44499ab82aSCarl Marcum## Installed Type Build Setup 45a7f3bf48SJohn Bampton 46499ab82aSCarl MarcumWhen we refer to an "installed" type build this means that you have built OpenOffice from source using build 47499ab82aSCarl Marcumconfig flag `--with-package-format="installed"`. 48499ab82aSCarl Marcum 49499ab82aSCarl MarcumCompiling the tests now require an SDK to be included in the office directory layout. When compiling tests using an "installed" 50499ab82aSCarl Marcumtype build, the office and the SDK are in built into separate directories and need combined. One method is to copy them into 51499ab82aSCarl Marcumthe test directory layout. 52499ab82aSCarl Marcum 53499ab82aSCarl MarcumIf you have just built an "installed" build of the office you should have environment variables set you can use. 54499ab82aSCarl MarcumFor example on my Linux machine my local OpenOffice source repo is `/home/carl/dev-git/openoffice` and my variables are set like this: 55a7f3bf48SJohn Bampton 56499ab82aSCarl Marcum```shell 57499ab82aSCarl MarcumSOURCE_ROOT_DIR=/home/carl/dev-git/openoffice 58499ab82aSCarl MarcumSRC_ROOT=/home/carl/dev-git/openoffice/main 59499ab82aSCarl MarcumINPATH=unxlngx6.pro 60499ab82aSCarl Marcum``` 61499ab82aSCarl Marcum 62499ab82aSCarl MarcumIf you are using a new terminal you can run your environment setup script from `main` like: 63a7f3bf48SJohn Bampton 64499ab82aSCarl Marcum```shell 65499ab82aSCarl Marcumsource ./LinuxX86-64Env.Set.sh 66499ab82aSCarl Marcum``` 67499ab82aSCarl Marcum 68499ab82aSCarl MarcumIf you have not previously ran tests you may not have a `testspace` directory under `test`. If not create it: 69a7f3bf48SJohn Bampton 70499ab82aSCarl Marcum```shell 71499ab82aSCarl Marcummkdir $SOURCE_ROOT_DIR/test/testspace 72499ab82aSCarl Marcum``` 73499ab82aSCarl Marcum 74499ab82aSCarl MarcumAnd the directory for the office: 75a7f3bf48SJohn Bampton 76499ab82aSCarl Marcum```shell 77499ab82aSCarl Marcummkdir $SOURCE_ROOT_DIR/test/testspace/install 78499ab82aSCarl Marcum``` 79499ab82aSCarl Marcum 80499ab82aSCarl MarcumNow copy the "installed" office from the build location: 81a7f3bf48SJohn Bampton 82499ab82aSCarl Marcum```shell 83499ab82aSCarl Marcumcp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice/installed/install/en-US/openoffice4 $SOURCE_ROOT_DIR/test/testspace/install/ 84499ab82aSCarl Marcum``` 85499ab82aSCarl Marcum 86499ab82aSCarl MarcumThen copy the SDK into the office: 87a7f3bf48SJohn Bampton 88499ab82aSCarl Marcum```shell 89499ab82aSCarl Marcumcp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice_SDK/installed/install/en-US/openoffice4/sdk $SOURCE_ROOT_DIR/test/testspace/install/openoffice4/ 90499ab82aSCarl Marcum``` 91a7f3bf48SJohn Bampton 92499ab82aSCarl Marcum## Compiling the Tests 93a7f3bf48SJohn Bampton 94499ab82aSCarl MarcumThe tests are built using Ant and passing an `openoffice.home` property with the location of the office needed for dependencies. 95499ab82aSCarl Marcum 96499ab82aSCarl Marcum"installed" build example: 97a7f3bf48SJohn Bampton 98499ab82aSCarl Marcum```shell 99499ab82aSCarl Marcumant -Dopenoffice.home="$PWD/testspace/install/openoffice4" compile 100499ab82aSCarl Marcum``` 101a7f3bf48SJohn Bampton 102499ab82aSCarl MarcumOr an office in the standard Linux installation directory: 103a7f3bf48SJohn Bampton 104499ab82aSCarl Marcum```shell 105499ab82aSCarl Marcumant -Dopenoffice.home="/opt/openoffice4" compile 106499ab82aSCarl Marcum``` 107a7f3bf48SJohn Bampton 108bc6c8f65SCarl MarcumOr Windows 109a7f3bf48SJohn Bampton 110bc6c8f65SCarl Marcum```shell 111bc6c8f65SCarl Marcumant -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" compile 112bc6c8f65SCarl Marcum``` 113499ab82aSCarl Marcum 114499ab82aSCarl Marcum## Running Tests 115a7f3bf48SJohn Bampton 116ce881ba3SDamjan JovanovicThere are several test suites available. API test, Build Verification Test (BVT), Function Verification Test (FVT), and Performance Verification Test (PVT). 117ce881ba3SDamjan Jovanovic 118ce881ba3SDamjan JovanovicThe **API** test will test OpenOffice using UNO API tests ported from main/qadevOOo. 119499ab82aSCarl Marcum 120499ab82aSCarl MarcumThe **Build Verification Test** Suite includes approximately fifty unit tests used for general build verification. 121499ab82aSCarl Marcum 122499ab82aSCarl MarcumThe **Functional Verification Test** Suite includes almost nine hundred unit tests to more thoroughly test the office features and UI. 123499ab82aSCarl Marcum_Not all tests are ran for each platform._ 124499ab82aSCarl Marcum 125499ab82aSCarl Marcum### Running a Complete Test Suite 126a7f3bf48SJohn Bampton 127bc6c8f65SCarl MarcumBVT Example (Linux): 128a7f3bf48SJohn Bampton 129499ab82aSCarl Marcum```shell 130499ab82aSCarl Marcum./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp bvt 131499ab82aSCarl Marcum``` 132a7f3bf48SJohn Bampton 133bc6c8f65SCarl MarcumBVT Example (Windows): 134a7f3bf48SJohn Bampton 135bc6c8f65SCarl Marcum```shell 136bc6c8f65SCarl Marcum.\run.bat -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" -tp bvt 137bc6c8f65SCarl Marcum``` 138a7f3bf48SJohn Bampton 139499ab82aSCarl MarcumFVT Example: 140a7f3bf48SJohn Bampton 141499ab82aSCarl Marcum```shell 142499ab82aSCarl Marcum./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp fvt 143499ab82aSCarl Marcum``` 144a7f3bf48SJohn Bampton 145ce881ba3SDamjan JovanovicAPI test Example (Linux): 146ce881ba3SDamjan Jovanovic./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp api 147a7f3bf48SJohn Bampton 148499ab82aSCarl Marcum### Running a Single Class 149a7f3bf48SJohn Bampton 150499ab82aSCarl Marcum```shell 151499ab82aSCarl Marcum./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tc bvt.gui.BasicFunctionTest 152499ab82aSCarl Marcum``` 153a7f3bf48SJohn Bampton 154499ab82aSCarl Marcum### Running a Single Test Method 155a7f3bf48SJohn Bampton 156499ab82aSCarl Marcum```shell 157499ab82aSCarl Marcum./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tm bvt:bvt.gui.BasicFunctionTest.testFindFormulasAndValues 158499ab82aSCarl Marcum``` 159a7f3bf48SJohn Bampton 160499ab82aSCarl Marcum### Run Help 161a7f3bf48SJohn Bampton 162499ab82aSCarl Marcum```shell 163499ab82aSCarl Marcum./run -help 164499ab82aSCarl Marcum``` 165499ab82aSCarl Marcum 166499ab82aSCarl Marcum## Test Results 167a7f3bf48SJohn Bampton 168499ab82aSCarl MarcumBy default, the testing output is stored in `test/testspace/output.***` where *** is the test suite type. 169499ab82aSCarl Marcum 170499ab82aSCarl Marcum* result.xml: Test result in HTML. 171499ab82aSCarl Marcum* result.html: Test result in XML. 172499ab82aSCarl Marcum* screenshot/: Screenshot pictures when test assert is failed. 173499ab82aSCarl Marcum 174499ab82aSCarl MarcumOpen `test/testspace/output.***/result.html` in your browser to see the testing report. 175499ab82aSCarl Marcum 176499ab82aSCarl Marcum## Cleaning Up 177a7f3bf48SJohn Bampton 178499ab82aSCarl MarcumRunning clean will delete compiled classes and build directories. 179a7f3bf48SJohn Bampton 180499ab82aSCarl Marcum```shell 181499ab82aSCarl Marcumant clean 182499ab82aSCarl Marcum``` 183a7f3bf48SJohn Bampton 184499ab82aSCarl MarcumThe `test/testspace` directory, test results and "installed" office if used need to be manually deleted when no longer needed. 185