Flex unit testing integration

Requirements

for more information on requirements for testing please check this document .

How it works

To be able to run unit tests based on Flex Unit, you should add all the libraries required to execute your tests to your POM dependencies section, including the Flex Unit library. These dependencies should be added with the test scope.

    ...
    <dependencies>
        ...
        <dependency>
            <groupId>com.adobe.flexunit</groupId>
            <artifactId>flexunit</artifactId>
            <version>0.9</version>
            <type>swc</type>
            <scope>test</scope>
        </dependency>
    </dependencies>
...

The Maven Flex Plugin will try to add to the test suite every file with a filename matching onr of the following patterns Test*.as or Test*.mxml. These files have to reside in test source directory (defauls to src/test/flex). No additional configuration is required as the plugin creates a unit test launcher.

As the test phase is part of the standard build lifecycle, tests will be executed each time you run one of the package , install or deploy goals.

If you need to execute unit tests separately, use the flex:test goal.

Skipping tests

Skipping tests is not a good practice, but if you need to do it occasionnally use the skipTests property of the configuration section or run Maven with the maven.test.skip property.

mvn clean install -Dmaven.test.skip=true

Skipping individual tests

If you need to disable a specific test at the class-level, you can use ActionScript metadata tag. This way, you do not have to modify the POM file each time you want to exclude a test or another.

[IgnoreTest]
public class TestToIgnore extends TestCase
{
        ...
}