How to build and testOnce you have everything configured, building and testing FlexUnit is easy and fast - it takes only a few minutes. Selecting what to buildTo 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 FlexUnitSet up your development environmentThe 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 AntWe 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 EclipseThe 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 lineTo build FlexUnit from the command line using Apache Ant, execute ant -q createFlexUnitLib This compiles FlexUnit into a library named FlexUnit.swc and places it into the bin directory. Command line build setupBefore 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
The following sections discuss these requirements in general terms. Java 2 Software Development KitA 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 variablesThere are three environment variables – JAVA_HOME, ANT_HOME, and PATH – which must be properly set before FlexUnit can be built, tested, and used. JAVA_HOMEThis must point to the J2SDK directory, which should contain bin and lib directories. ANT_HOMEThis must point to the Ant directory, which should contain bin and lib directories. PATHThe following three directories should be at the beginning of the PATH:
This will allow command-line tools such as mxmlc, compc, ant, and java to be found no matter what your current directory is. Testing FlexUnitTesting using FlexBuilderTo 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/FlexBuilderTo 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 AntTo run the FlexUnit unit tests, execute ant -q runTests Other Ant TargetsThe Ant build script also contains the following targets of note compileTestsCompiles the tests, but does not run them createASDocCreates ASDoc for the FlexUnit library in the asdoc directory. createDistributionCompiles the FlexUnit library, generates the asdoc, and creates a zip file containing both in the distrib directory.
|
|