Copy link to clipboard
Copied
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 >
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Copy link to clipboard
Copied
thx, I took the swc from the zip and not the one build from flex3 and took the example and it works.
Keep up the good work !