Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Introduction

There is SDK-wide support for FlexUnit tests, and each project maintains it's its own set of tests. It currently works like this:

  1. The main build script (build.xml) has a target called 'test'; this . This target is not part of the 'main' run and does nothing but call. It simply calls:
  2. The frameworks build script's 'test' target in frameworks/build.xml, which cleans the previous test reports and calls any test targets ('xxxtargets that may exist (e.g. 'apache-test') that may exist, which in turn call:
  3. The project build script's 'test' target , that of that project's build script, which sets up the project-specific properties (such as project root folder) 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 (step 3 above), it runs any FlexUnit tests that have been set up for that project and reports back success their successes or failfailures.

 

How to add the first unit tests to a project without tests

Any project 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.

Add tests to SDK project

xxx

. First, write your tests. Then:

 

1. Add the tests to the SDK project

 

If it does not yet exist, create a 'tests/[somePackage]' directory in the root directory of the project (meaning it will be on the same level with the 'src' directory), e.g.:

Info
./frameworks/projects/apache/tests/promises

 

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

Info

'PromisesBasicTests.as' or 'FLEX_34625_Tests.as'

2. Add test run to SDK build scripts

xxxIf 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:

Code Block
themeConfluence
languagexml

...

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

 

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

Code Block
themeConfluence
languagexml
<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: 

Code Block
themeConfluence
languagexml
<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>