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.


Twitter Bookmark Unit Testing With Flex Mojos  at del.icio.us Facebook Google Bookmarks Digg Unit Testing With Flex Mojos Bookmark Unit Testing With Flex Mojos  at YahooMyWeb

Trackbacks


Trackback specific URI for this entry
    No Trackbacks

Comments


    #1 Michael on 03/30/09 at 04:43 PM [Reply]
    *Have you been able to see the stack traces of your tests? It seems to be a known problem that you can't see any useful output without running maven in -X mode...
    #1.1 Carsten Schlipf on 03/31/09 at 09:52 AM [Reply]
    *You are right! I haven't noticed it yet, but in the surefire reports I am also missing the stack trace.

    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.
    #1.1.1 Pulkit Singhal on 08/20/10 at 04:42 PM [Reply]
    *That's very interesting, I would really like to find out how you keep a separate project for the tests and still manage to reference the source from the application project in order to test it. Could you share your pom configuration tips for splitting the flex app and tests across 2 separate eclipse or maven multi-module projects?
    #1.1.1.1 Carsten Schlipf on 08/20/10 at 04:58 PM [Reply]
    *As for library project that is not a big problem - just declare a dependency to this library.

    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.
    #1.1.1.2 Carsten Schlipf on 08/21/10 at 12:10 PM [Reply]
    *Actually to answer your questions for applications: Just configure the sourcePaths of your flexmojos-maven-plugin configuration in your flex unit project to point to the source path of your application. However this makes the flex unit project depending on a relative path to your application project, which violates another principle of a clean maven project.

    Really not recommended.
    #2 eric johnson on 08/11/09 at 10:52 PM [Reply]
    *Great Blog. I have a question about skipping the tests.
    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.
    #2.1 Carsten Schlipf on 08/12/09 at 09:01 AM [Reply]
    *Hi Eric

    I am using flex-mojos 3.3.0 and -Dmaven.test.skip=true works here. Maybe a bug in 3.2.0?
    #2.2 Amar on 02/18/10 at 11:10 AM [Reply]
    *<properties>
    <flex.sdk.version>3.3.0.4852</flex.sdk.version>
    <maven.test.skip>true</maven.test.skip>
    </properties>

Add Comment

HTML-Tags will be converted to Entities.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA