How to build and test
Once you have everything configured, building and testing FlexUnit is easy and fast - it takes only a few minutes.
Selecting what to build
To do a build, first decide whether you want to build the trunk, a branch, or a tag. (Tags are particular releases, such as the 0.9 release.)
Building FlexUnit
Set up your development environment
The following instructions provide details to help you set up your development environment to build and test FlexUnit, using either FlexBuilder, Eclipse or the command line.
Apache Ant
We use Apache Ant, an open-source Java-based build system, to build the FlexUnit. The build directory inside FlexUnit has a build.xml files, which is an Ant script written in XML format.
Before building or testing using Ant, you should first change the build.properties file in the build dirextory to reflect the location of resources such as the Flex SDK and the Flash Player on your own system.
Building using FlexBuilder or Eclipse
The directory structure within SubVersion contains two FlexBuilder Projects, on for the FlexUnit library, and one for its unit tests. See FlexUnit Organization for more details.
If you have FlexBuilder installed, simply import the projects into your workspace, and they will automatically build, and you can thereafter run the test runner within the FlexUnitTest project. Alternatively, if you have Ant enabled in your FlexBuilder installation (ie. you have installed the FlexBuilder plugin to Eclipse), you can execute the ant build script to compile and test FlexUnit.
If you do not have FlexBuilder, you can still use built-in Ant support of Eclipse to build and test FlexUnit.
Building using the command line
To build FlexUnit from the command line using Apache Ant, execute
This compiles FlexUnit into a library named FlexUnit.swc and places it into the bin directory.
Command line build setup
Before you can build the FlexUnit from source code and then test it, you may need to do some one-time setup. In addition to the source code, which you check out from the repository with a Subversion client, you'll need to
- have an appropriate command-line shell
- have a Java 2 Software Development Kit (J2SDK)
- have Apache Ant
- set certain environment variables
The following sections discuss these requirements in general terms.
Java 2 Software Development Kit
A J2SDK contains a Java compiler and a Java runtime environment. Since the Flex SDK's compiler tools are written in Java, you need a J2SDK to compile and test FlexUnit.
Environment variables
There are three environment variables – JAVA_HOME, ANT_HOME, and PATH – which must be properly set before FlexUnit can be built, tested, and used.
JAVA_HOME
This must point to the J2SDK directory, which should contain bin and lib directories.
ANT_HOME
This must point to the Ant directory, which should contain bin and lib directories.
PATH
The following three directories should be at the beginning of the PATH:
- the bin directory of the FlexUnit branch that you're using
- Ant's bin directory, $ANT_HOME/bin
- Java's bin directory, $JAVA_HOME/bin
This will allow command-line tools such as mxmlc, compc, ant, and java to be found no matter what your current directory is.
Testing FlexUnit
Testing using FlexBuilder
To run the FlexUnit tests within FlexBuilder, run the FlexUnitTestRunner.mxml file in the src folder of the FlexUnitTest FlexBuilder project.
Testing using Apache Ant in Eclipse/FlexBuilder
To run the FlexUnit tests using Ant within an Eclipse based environment, add the build.xml file in the build directory of the FlexUnitLib library project to the Ant panel of eclipse, and execute the runTests target.
Testing using Apache Ant
To run the FlexUnit unit tests, execute
Other Ant Targets
The Ant build script also contains the following targets of note
compileTests
Compiles the tests, but does not run them
createASDoc
Creates ASDoc for the FlexUnit library in the asdoc directory.
createDistribution
Compiles the FlexUnit library, generates the asdoc, and creates a zip file containing both in the distrib directory.
| You must be logged in to comment. |
|