Name Date Size #Lines LOC

..--

smoketestdoc/H--2,9932,101

testassistant/H--1,429907

testassistant.feature/H--255199

testcommon/H--9,8755,641

testgui/H--20,72717,357

testuno/H--42,66828,154

README.mdH A D04-Aug-20256.5 KiB185105

build.xmlH A D24-Jul-20257.5 KiB200155

runH A D31-May-20211.4 KiB306

run.batH A D28-Feb-20251.3 KiB2523

README.md

1<!--
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements.  See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership.  The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License.  You may obtain a copy of the License at
9
10   http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied.  See the License for the
16 specific language governing permissions and limitations
17 under the License.
18-->
19
20# Apache OpenOffice<sup>®</sup> Test
21
22Apache OpenOffice contains automated test suites that can be ran against the office. The test framework is written in **Java** and based on **JUnit 4**.
23
24This **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.
25
26The test suite in main branches **AOO41X** and **AOO42X** can be ran against a normal installation of the office or a just built "installed" office.
27
28This 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`.
29Primarily these dependencies are things the Java UNO jars like juh, jurt, ridl, and unoil and tools like javamaker, regmerge, and idlc.
30
31This **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**.
32
33This README is documentation for using the test suites without requiring an office build environment or having built the office from source in any branch.
34
35## Prerequisites
36
37Apache 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.
38
39## Caution
40
41When switching branches especially between AOO versions it's recommended to delete the jars in `test/lib` which will make
42sure 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.
43
44## Installed Type Build Setup
45
46When we refer to an "installed" type build this means that you have built OpenOffice from source using build
47config flag `--with-package-format="installed"`.
48
49Compiling the tests now require an SDK to be included in the office directory layout. When compiling tests using an "installed"
50type build, the office and the SDK are in built into separate directories and need combined. One method is to copy them into
51the test directory layout.
52
53If you have just built an "installed" build of the office you should have environment variables set you can use.
54For example on my Linux machine my local OpenOffice source repo is `/home/carl/dev-git/openoffice` and my variables are set like this:
55
56```shell
57SOURCE_ROOT_DIR=/home/carl/dev-git/openoffice
58SRC_ROOT=/home/carl/dev-git/openoffice/main
59INPATH=unxlngx6.pro
60```
61
62If you are using a new terminal you can run your environment setup script from `main` like:
63
64```shell
65source ./LinuxX86-64Env.Set.sh
66```
67
68If you have not previously ran tests you may not have a `testspace` directory under `test`.  If not create it:
69
70```shell
71mkdir $SOURCE_ROOT_DIR/test/testspace
72```
73
74And the directory for the office:
75
76```shell
77mkdir $SOURCE_ROOT_DIR/test/testspace/install
78```
79
80Now copy the "installed" office from the build location:
81
82```shell
83cp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice/installed/install/en-US/openoffice4 $SOURCE_ROOT_DIR/test/testspace/install/
84```
85
86Then copy the SDK into the office:
87
88```shell
89cp -r $SRC_ROOT/instsetoo_native/$INPATH/Apache_OpenOffice_SDK/installed/install/en-US/openoffice4/sdk $SOURCE_ROOT_DIR/test/testspace/install/openoffice4/
90```
91
92## Compiling the Tests
93
94The tests are built using Ant and passing an `openoffice.home` property with the location of the office needed for dependencies.
95
96"installed" build example:
97
98```shell
99ant -Dopenoffice.home="$PWD/testspace/install/openoffice4" compile
100```
101
102Or an office in the standard Linux installation directory:
103
104```shell
105ant -Dopenoffice.home="/opt/openoffice4" compile
106```
107
108Or Windows
109
110```shell
111ant -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" compile
112```
113
114## Running Tests
115
116There are several test suites available. API test, Build Verification Test (BVT), Function Verification Test (FVT), and Performance Verification Test (PVT).
117
118The **API** test will test OpenOffice using UNO API tests ported from main/qadevOOo.
119
120The **Build Verification Test** Suite includes approximately fifty unit tests used for general build verification.
121
122The **Functional Verification Test** Suite includes almost nine hundred unit tests to more thoroughly test the office features and UI.
123_Not all tests are ran for each platform._
124
125### Running a Complete Test Suite
126
127BVT Example (Linux):
128
129```shell
130./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp bvt
131```
132
133BVT Example (Windows):
134
135```shell
136.\run.bat -Dopenoffice.home="C:\Program Files (x86)\OpenOffice 4" -tp bvt
137```
138
139FVT Example:
140
141```shell
142./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp fvt
143```
144
145API test Example (Linux):
146./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tp api
147
148### Running a Single Class
149
150```shell
151./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tc bvt.gui.BasicFunctionTest
152```
153
154### Running a Single Test Method
155
156```shell
157./run -Dopenoffice.home="$PWD/testspace/install/openoffice4" -tm bvt:bvt.gui.BasicFunctionTest.testFindFormulasAndValues
158```
159
160### Run Help
161
162```shell
163./run -help
164```
165
166## Test Results
167
168By default, the testing output is stored in `test/testspace/output.***` where *** is the test suite type.
169
170* result.xml: Test result in HTML.
171* result.html: Test result in XML.
172* screenshot/: Screenshot pictures when test assert is failed.
173
174Open `test/testspace/output.***/result.html` in your browser to see the testing report.
175
176## Cleaning Up
177
178Running clean will delete compiled classes and build directories.
179
180```shell
181ant clean
182```
183
184The `test/testspace` directory, test results and "installed" office if used need to be manually deleted when no longer needed.
185