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

Compare with Current View Page History

« Previous Version 3 Next »

Introduction

There is SDK wide support for FlexUnit tests, and each project maintains it's own set of tests.

  1. The main build script has a target 'test'; this target is not part of the 'main' run and does nothing but call:
  2. The frameworks build script's 'test' target, which cleans the previous test reports and calls any test targets ('xxx-test') that may exist, which in turn call
  3. The project build script's 'test' target, that sets up the project specific properties and calls back to
  4. 'flexunit-tests.xml' in the SDK root.
    This file is where the magic happens. Based on the input from the project build script, it runs any FlexUnit tests that have been set up for that project and reports back success or fail.

Any projects for which we want to add FlexUnit tests can easily hook into this system by adding the tests and add a copy of the 'test' target to their build script, following these steps:

Add tests to SDK project

If it does not yet exist, create a 'tests/[someName]' directory in the 'src' dir of the project, e.g.:

./frameworks/projects/apache/src/tests/promises

 

Create test classes in this directory or in a subdirectory thereof; make sure to use filenames that match '*Tests.as', e.g.:

'PromisesBasicTests.as' or 'FLEX_34625_Tests.as'

Add test run to SDK build scripts

If they do not yet exist, add the following tasks and calls to the following ant files, replacing '[project] with the name of the project, e.g. 'apache' or 'spark':

./frameworks/build.xml

In the target 'test', add the call:

<antcall target="[project]-test"/>

 

Add a target (near the bottom of the file):

<target name="[project]-test" description="Tests for '[project]' project">
    <ant dir="${basedir}/projects/[project]" target="test"/>
</target>

./framework/projects/[project]/build.xml

Add a target: 

<target name="test" description="Runs the FlexUnit tests for this project">
    <ant antfile="${FLEX_HOME}/flexunit-tests.xml">
        <property name="project.root" value="${basedir}"/>
    </ant>
</target>
  • No labels