You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

The automatic testing for the GEP is performed during the Maven build. The tests are run as JUnit 3 plug-in tests and use Abbot (an open source project) to perform the GUI testing of finding objects, testing objects, and driving objects.

Building and running via Maven

If building the entire GEP, the testsuite will be the last plugin built. As part of the normal build process, Maven will perform several step.

  1. Abbot plug-ins are downloaded into the M2 repo
  2. Uses Ant to install a Geronimo server into a launcher directory so that it can be used during testing.
  3. Compile the testsuite.
  4. Use Ant to start the testsuite.

This testsuite must run after the regular plug-in builds since it will test the plug-in code. To skip the tests, use mvn install -Pno-it.

Importing the testsuite into Eclipse

Download the following jars from sourceforge.net and put them in the eclipse plugins directory:
abbot.swt.jar, abbot.swt.test.jar, abbot.swt.eclipse.jar. Afterwards, you should be able to import the org.apache.geronimo.testsuite.v21 project.

Running the testsuite manually

If you are creating or updating test cases, it will be faster to run the test case from within Eclipse than to use Maven. Open the Run Configurations dialog and do the following:

  1. Create a new JUnit Plug-in Test
  2. Test page. Change Test Runner to be JUnit 3.
  3. Arguments page. Set the VM Arguments to -Xms256m -Xmx256m -XX:MaxPermSize=128m
  4. Main page. Find where the build installed the launcher and point the workspace location to the eclipse/eclipse/plugins directory that was created during the mvn install process. Set the workspace (on the main tab) to C:\g\devtools\eclipse-plugin\trunk\testsuite\launcher\eclipse\eclipse\plugin

Adding test cases

TODO

Abbot Coding

To make test case coding an easier task, an AbbotHelper class has been created. AbbotHelper acts as a wrapper for calls to the API and performs many of the most common GUI functions, clicking menus, entering text, pushing buttons, etc. New functions can easily be added to this class. Most Abbot functions follow the following template:

  1. Find unique object.
  2. Perform action on unique object.
  3. Wait for action to finish.

The 2 most common exceptions that Abbot throws are the ObjectNotFoundException and the MultiplesFoundException. ObjectNotFoundException is thrown when the code is looking for the wrong type of object or the String is not an exact match for an object. It is possible to use regular expressions in place of hard coded strings. For instance, if the title of a window is "Window (FFF)", where "FFF" represents a component and may change, you can change the title attribute of the component reference to "/Window .*/" so that the match string will always match the variable title.

Debugging Abbot code

Sometimes it is helpful to step though the Abbot code to figure out what it is expecting. In order to do this, you will need to get the source code and import it into Eclipse.

  1. svn https://abbot.svn.sourceforge.net/svnroot/abbot/abbot.swt/trunk c:\abbot
  2. Create folder c:\abbot\abbot.plain (must be named abbot.plain)
  3. svn https://abbot.svn.sourceforge.net/svnroot/abbot/abbot/trunk c:\abbot\abbot.plain
  4. In c:\abbot\abbot.swt, do ant -f setup.xml to create the c:\abbot\abbot.swt\lib\abbot.jar
  5. Copy from C:\abbot\abbot.plain\lib\ to C:\abbot\abbot.swt\lib\ the following jars: bsh-2.0b4.jar, gnu-regexp-1.1.0.jar, jdom-1.0.jar, xercesImpl-2.8.1.jar, xml-apis.jar
  6. Download MRJToolKitStubs.zip from http://developer.apple.com/samplecode/MRJToolkitStubs/index.html into C:\abbot\abbot.swt\lib\
  7. Import abbot.swt project into eclipse
  8. Ensure that all the .jars and the .zip from above are on the LIbraries path and the Order and Export Page
  9. In the MANIFEST.MF, add all available packages to the Exported Packages list. For the classpath, remove the "." library. Also add a new AbbotSWTplugin.jar and the jars and zip from above.
  • No labels