Unit Testing With Flex Mojos
Monday, March 30. 2009
When I tried to update another project to flexmojos-maven-plugin 3.x I realized that I missed a step, when I wrote the upgrade instructions from flex-mojos 2.0.0 to the newer plugin. While the first project was at its very beginning with no Unit tests existing yet, the newer project had already quite some unit tests.
When running maven after I followed my own instructions I go this error:
[ERROR] <PROJECT PATH>/target/test-classes/TestRunner.mxml:[-1,-1] Unable to locate specified base class 'org.sonatype.flexmojos.unitestingsupport.TestApplication' for component class 'TestRunner'.
To solve this you have to replace this dependency
<dependency> <groupId>flexunit.junit</groupId> <artifactId>flexunit-optional</artifactId> <type>swc</type> <scope>test</scope> </dependency>
by the newer:
<dependency>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-unittest-support</artifactId>
<type>swc</type>
<scope>test</scope>
<version>3.1-SNAPSHOT</version>
</dependency>
After that change the unit tests execute properly again.
Trackbacks
Trackback specific URI for this entry
No Trackbacks



Comments
However I prefer having a separate test runner project with a MXML applicaion containing the TestRunnerBase components. When a test case fails, I run this application from my IDE and I can not only see the stack trace but am also able to debug the test.
However I strongly discourage you to do so. You just would circumvent an essential key concept of Maven which is that only tested artifacts can be installed into the repository. You are opening the door to hell in case you separate unit tests from the code in Maven.
Really not recommended.
Is there an equivalent of -Dmaven.test.skip=true for the flexmojo which can be set in the pom.xml file.
With version 3.2.0, tests are failing if the FlashPlayer is not in the PATH and I want to disable (skip) the tests in the pom.xml.
I am using flex-mojos 3.3.0 and -Dmaven.test.skip=true works here. Maybe a bug in 3.2.0?
<flex.sdk.version>3.3.0.4852</flex.sdk.version>
<maven.test.skip>true</maven.test.skip>
</properties>