Automated Testing of Modeling Project Builds

last updated: November 9, 2005

Description

This document describes how to run the GMF JUnit test plugins from the command line. This is the same mechanism used in the builds.

Click here for a description of the testing framework, and how it can be used outside of the setup described here.

If you simply wish to write and run JUnit tests interactively from an Eclipse workbench, try one of the links below:

JUnit Support in Eclipse
Using JUnit

Requirements

1. All test machines must have a java runtime environment (version 1.3.1) installed and added to the path environment variable (see -vm parameter below).
2. Info-ZIP UnZip version 5.41 or later installed and added to the path.
3. The Automated Test feature from a MDT downloads. This contains the test framework plugins and the JUnit test plugins to run.
4. The GMF zip file from the same build as the Automated Test feature. You can use the gmf-sdk zip file instead of the individual files.
5. An Eclipse SDK zip file. The URL and build name of the required builds are specified in the build.cfg file included in the Automated Test zip file.

Setup

1. Extract the gmf-*-automated-tests-<buildId>.zip. On Window, extract this file close to the root of the drive to prevent some path names from exceeding the 255 character limit. This will create a top-level directory "testing".
2. Place the Eclipse SDK zip file and the GMF runtime in the testing directory. Do not unzip these files. (The test scripts will take care of this)

Running Tests

1. cd to the testing directory
2. Run the following script:

runtests [-os <operating system>] [-ws <windowing system>] [-arch <architecture>] [-noclean] [<testTarget>][-properties <path>][-vm <path to java executable>]

All parameters and targets are optional on windows systems. Just running "runtests" will run ALL tests on Windows, installing a clean Eclipse and GMF SDK between each test target. On *nix systems, the os, ws and arch parameters must be specified.
Test results are placed in the testing/results directory in xml and html format.

Parameters

Parameter | Description
-os <operating system> | The OS the tests are being run on. One of: aix, hpux, linux, qnx, solaris, win32. Default win32
-ws <windowing system> | The windowing system the tests are being run on. One of: motif, gtk, photon, win32. Default win32
-arch <architecture> | The architecture the tests are being run on. One of: ppc, PA_RISC, x86, sparc. Default x86
-noclean | Run tests without installing an Eclipse and GEF SDK and tests between test targets. Default is to re-install these between test targets.
-properties | Used to reference a properties file containing additional Ant properties used in running tests.Can be used to pass additional vm arguments to the Java virtual machine running the tests by adding the entry "extraVMargs=<the args to pass to the vm>" to the specified properties file.
-vm | The full path to the java executable with which to run the tests. Use this to specify a specific virtual machine with which to run the tests. For example, "-vm c:\sun131\jre\bin\java". Default set to "java" (i.e. java executable on system path).

Test Targets

Specifies which ant target to run in the main test.xml. Typically this corresponds to a test project's tests. If you do not specify a test target then the all test target is run.

all | Runs all the targets below.
gmf | Runs the JUnit tests located in the test plug-ins
genHtml | Converts xml test results in the "testing/results" directory to html.

Appendix A- Supported os, ws, and arch value combinations

The following table contains the values that can be used with the -os, -ws, and -arch switches.

Operating System (os) | Windowing System (ws) | Architecture (arch)
aix | motif | ppc
hpux | motif | PA_RISC
linux | gtk | x86
linux | motif | x86
qnx | photon | x86
solaris | motif | sparc
win32 | win32 | x86