Getting Started with Test Automation
Two kind of approaches is supported by Apache OpenOffice.
- GUI Testing: Simulating a common user to perform testing. It depends on a Java library named VCLAuto, which does testing like the old VCLTesttool. It can easily integrates with JUnit. VCLAuto provides APIs to generate user interface events such as keystrokes and mouse clicks, do GUI actions and get information from the GUI to validate functions.
- UNO API Testing: Use UNO API to verify functions.
There are some reasons for test failures, so please prepare your testing machine before running test.
Getting the source code
Anyone can checkout source code from our Subversion repository. Run the following command.
svn co https://svn.apache.org/repos/asf/openoffice/trunk/test/ test
If you are not familiar with Subversion, see our Subversion Basics for more information.
Getting started with Eclipse
- Eclipse Java IDE: Eclipse Juno(4.2) IDE for Java Developers or above.
- Apache OpenOffice
Step 1. Open Eclipse, click menu "File->Import…", and then select "General->Existing Projects into Workspace".
Step 2. Click next, set "Select root directory" to the source code directory, and then check the following projects.
testcommon: The project includes the common test utilities and low-level implementation to do GUI testing testgui: The project includes the GUI testing scripts. testuno: The project includes the UNO API testing scripts.
Step 3. Click "Finish" to import the projects.
Step 4. Click menu "Window->Preferences" ("Eclipse->Preferences" on Mac) and then select "Java->Build Path->Classpath Variables" page.
Click "New" to create one new variable "openoffice.home", and set its value to Apache OpenOffice installation directory.
| The default installation directory of Apache OpenOffice|
Mac OS X: "/Applications/OpenOffice.app/Contents"
Click "OK" to close "New Variable Entry"dialog. Then click "OK" button of preferences dialog. A message box pops up. Click "Yes".
Step 1. Select one test class. e.g. testcase.gui.AOOTest, and then click "Run" on the toolbar to start testing.
When testing is finished, JUnit view will show the result.
You also can select one package, click "Run", and then choose "JUnit test" to run all test classes under it.
Getting started with command line
- JDK: JDK 1.5, JDK 1.6 or above.
- Ant: Apache Ant 1.8.2 or above.
- JUnit: JUnit 4.10 or above. For lazy people, if internet is available, it can be automatically installed during testing.
As a developer, how to run testing against an OpenOffice built by me?
It's easy for developers to run testing after building OpenOffice. One thing you need to do is to make sure you run the commands in the build environment. The script will automatically install your build and then start testing. e.g.
cd main source MacOSXX86Env.Set.sh cd ../test && ant
As a normal user, how to run testing against an installed OpenOffice?
Firstly compile the project with the command under test module.
ant -Dopenoffice.home="OpenOffice installation directory" compile
Then start testing with the command "run". e.g. Run all test classes under package bvt ("Build Verification Testing")
run -Dopenoffice.home="/Applications/OpenOffice.app/Contents" -tp bvt
e.g. Run the given test classes
run -Dopenoffice.home="/Applications/OpenOffice.app/Contents" -tc bvt.gui.BasicFunctionTest
On Linux use e.g. -Dopenoffice.home="/opt/openoffice4/program" instead.
Where to get the testing result?
By default, the testing output is stored in "test/testspace/output***". Open "test/testspace/output/result.html" in your browser to see the testing report.
File:Test automation report.png
Special stuff in the output directory.
result.xml: Test result in HTML. result.html: Test result in XML. screenshot/: Screenshot pictures when test assert is failed.
Now, all things have been ready for developing new test code. If you are interested, please read GUI Testing Development and UNO API Testing Development to get more information.