Difference between revisions of "QA/test automation guide"
(→Run testing) |
(→Run testing) |
||
Line 34: | Line 34: | ||
=== Run testing === | === Run testing === | ||
− | '''Step 1.''' Click menu "Window->Preferences" ("Eclipse->Preferences" on Mac) and then select "Java->Build Path->Classpath Variables" page.<br /> | + | '''Step 1.''' Specify where Apache OpenOffice is located. <br /> |
− | + | Click menu "Window->Preferences" ("Eclipse->Preferences" on Mac) and then select "Java->Build Path->Classpath Variables" page.<br /> | |
− | Click "New" to create one new variable "openoffice.home", and set its value to Apache OpenOffice installation directory. | + | [[File:test_automation_guide_10.png]]<br /> |
− | + | Click "New" to create one new variable "'''openoffice.home'''", and set its value to Apache OpenOffice installation directory. | |
− | {{Template:Documentation/Note| '''The default | + | [[File:test_automation_guide_11.png]]<br /> |
+ | {{Template:Documentation/Note| '''The default installation directory of Apache OpenOffice'''<br /> | ||
Mac OS X: "''/Applications/OpenOffice.org.app/Contents"''<br /> | Mac OS X: "''/Applications/OpenOffice.org.app/Contents"''<br /> | ||
Linux: "''/opt/openoffice.org3''"<br /> | Linux: "''/opt/openoffice.org3''"<br /> | ||
Line 44: | Line 45: | ||
Windows 64b: "''C:/Program Files (x86)/OpenOffice.org 3''" | Windows 64b: "''C:/Program Files (x86)/OpenOffice.org 3''" | ||
}} | }} | ||
− | + | Click "OK" to close "New Variable Entry"dialog. Then click "OK" button of preferences dialog. A message box pops up. Click "Yes".<br /> | |
− | + | [[File:test_automation_guide_12.png]]<br /> | |
− | + | ||
− | Click " | + | |
− | + | ||
− | [[File: | + | |
− | + | ||
'''Step 2.''' Select one test class. e.g. testcase.gui.AOOTest, and then click "Run" on the toolbar to start testing. <br /> | '''Step 2.''' Select one test class. e.g. testcase.gui.AOOTest, and then click "Run" on the toolbar to start testing. <br /> | ||
[[File:vclauto_guide_14.png]]<br /> | [[File:vclauto_guide_14.png]]<br /> |
Revision as of 12:57, 16 August 2012
Contents
Introduction
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.
Notice
TCP/IP will be used during testing. It may lead your firewall to show some warning messages.
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/incubator/ooo/trunk/main/test/ test
If you are not familiar with Subversion, see our Subversion Basics for more information.
Getting started with Eclipse
Prerequisites
- Eclipse Java IDE: Eclipse Juno(4.2) IDE for Java Developers or above.
- Apache OpenOffice
Setup project
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.
Run testing
Step 1. Specify where Apache OpenOffice is located.
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.
Template:Documentation/Note
Click "OK" to close "New Variable Entry"dialog. Then click "OK" button of preferences dialog. A message box pops up. Click "Yes".
Step 2. Select one test class. e.g. testcase.gui.AOOTest, and then click "Run" on the toolbar to start testing.
File:Vclauto guide 14.png
When testing is finished, JUnit view will show the result.
File:Vclauto guide 16.png
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
Prerequisites
- 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.
Run testing
How do I run testing on OpenOffice?
Run the following commands.
cd test ant -Dtest.classes="Test class list" -Dopenoffice.home="Your OpenOffice installation directory which contains soffice.bin"
e.g. Run testcase.gui.AOOTest and testcase.gui.SmokeTest against OpenOffice installed in "/Applications/OpenOffice.org.app"
cd test ant -Dtest.classes="testcase/gui/AOOTest.class,testcase/gui/SmokeTest.class" -Dopenoffice.home="/Applications/OpenOffice.org.app/Contents/MacOS"
e.g. Run all test classes under package testcase.gui.sc
cd test ant -Dtest.classes="testcase/gui/sc/**/*.class" -Dopenoffice.home="/Applications/OpenOffice.org.app/Contents/MacOS"
If test.classes is not specified, BVT will be executed. If openoffice.home is not specified, it will try to test OpenOffice installed in the default directory[1]. e.g. Run BVT against OpenOffice in the default directory.
cd test ant
As a developer, how do I run testing against my own build?
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.
source MacOSXX86Env.Set.sh cd test && ant
Where to get the testing result?
By default, the testing output is stored in "test/testspace/output". Open "test/testspace/output/report/index.html" in your browser to see the testing report.
File:Vclautoreport.png
There are several directories to store special stuff.
report/: Test result in HTML. result/: Test result in XML. screenshot/: Screenshot pictures when test assert is failed. logs/: The detail log.
Development
Now, all things have been ready for developing new test code. If you are interested, please read GUI Testing Development to get more information.
Note
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedFoot1