Skip navigation
mouais666
Currently Being Moderated

Implicit coercion of a value of type flexunit.flexui:TestRunnerBase to an unrelated type org.flexunit.runner:IRunner.

Sep 16, 2009 4:53 AM

Hello all,

 

any idea for this error ?

 

Severity and Description    Path    Resource    Location    Creation Time    Id
1067: Implicit coercion of a value of type flexunit.flexui:TestRunnerBase to an unrelated type org.flexunit.runner:IRunner.    QuizzGame/src    QuizzTest.mxml    line 21    1253101842782    7688


in my project lib :

FlexUnit1Lib.swc

FlexUnit4.swc

fluint-1_2.swc

Hamcrest.swc


I created the QuizzTest.mxml    file and impossible to compile due to the error specified before :


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                        xmlns="*"
                        creationComplete="onCreationComplete()"
                        xmlns:flexunit="flexunit.flexui.*">
    <!--
    -->
    <mx:Script>
        <![CDATA[
            import org.flexunit.runner.notification.IRunListener;
            import org.flexunit.runner.FlexUnitCore;

 


            import com.ao.quizzgame.test.CheckTestSuite;
            import flexunit.framework.TestSuite;
            private var flexUnitCore:FlexUnitCore;

 


            // Create the test suite and run the tests
            private function onCreationComplete():void
            {
                flexUnitCore=new FlexUnitCore();
                flexUnitCore.runRunner(testRunner);
                //This run statements executes the unit tests for the FlexUnit4 framework
                flexUnitCore.run(CheckTestSuite);
            }
        ]]>
    </mx:Script>
    <flexunit:TestRunnerBase id="testRunner"
                             width="100%"
                             height="100%"/>

 

 

 

</mx:Application >

 
Replies
  • Currently Being Moderated
    Sep 16, 2009 7:07 AM   in reply to mouais666

    Yes,

     

    first, remove this line:

     

    flexUnitCore.runRunner(testRunner);

     

    second, there is likely some confusion around the naming here which we need to address. The TestRunnerBase is a left over name from FlexUnit1 that we should really change. It is just a UI at this point, it doesn't actually have anything to do with running tests. But your code looks a bit like a combination of FlexUnit .9 and FlexUnit 4, so be careful there. I would really recommend grabbing the FlexUnit4 turnkey project and ensuring you are using all of the libraries from there:

     

    Below is an example of the corrected syntax from the FlexUnit 4 turnkey project. You will not a few difference, first, there is no call to runRunner, the UI listens to the FlexUnitCore which does all of the running. Also, to reinforce this the TestRunnerBase is named UIListener (which was my first clue that there were somethings copied from a FlexUnit1 project). You can dowload the turnkey project completely from opensource.adobe.com

     

    core = new FlexUnitCore();
    core.addListener( new UIListener( uiListener ));
    core.run( whatever you want );

         <flexUnitUIRunner:TestRunnerBase id="uiListener"
              width="100%" height="100%" />

    HTH,
    Mike


     
    |
    Mark as:
  • Currently Being Moderated
    Aug 18, 2010 4:15 PM   in reply to Michael Labriola

    oh thanks I was looking for this, removing the firs line and it's working.

     

    thanks so much

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points