Вопрос

I'm getting an error with FlexUnit 4 that I am not able to find a solution for. Here is the error:

Could not resolve to a component implementation.

Here is my sample app (I am using FlashBuilder 4 Premium so I assume all necessary SWCs are already installed):

<?xml version="1.0" encoding="utf-8"?>

<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
    <![CDATA[

        import sampleSuite.SampleSuite;
        import org.flexunit.listeners.UIListener;
        import compilationSuite.SuitesToRun;
        import org.flexunit.runner.FlexUnitCore;

        private var core:FlexUnitCore;
        public function runMe():void {
            core = new FlexUnitCore();
            core.addListener( uiListener );
            core.run( sampleSuite.SampleSuite );
        }

    ]]>
</fx:Script>

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

The one idea I found is from FlexUnit support site and it says that if my namespace isn't wrong (and it isn't) then I'm missing this file: FlexUnit4UIListener.swc

I'm using FlashBuilder 4 and Flex 4.5.1 SDK. In my build path I'm referencing these three files and their SWCs:

C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\eclipse\plugins\com.adobe.flexbuilder.flexunit_4.0.1.277662\flexunitframework\libs\version4libs{Common,FlexProject, and locale/version4locale}

Do I need more SWCs in my project's libs folder, too? What could I be missing?

Это было полезно?

Решение 2

I believe the issue must be something about importing the SWC files incorrectly. Regardless, I have upgraded to FlashBuilder 4.6 and found an article that shows me how to use FlexUnit4 and I've got it working without issue.

Here is the link to that article just in case someone else might find it usefule: http://www.adobe.com/devnet/flex/articles/flashbuilder4_tdd.html

Другие советы

Are you sure the namespace is "adobe"? Usually I would assume something like "flexunit". Do you have the following Namespace-Declaration in the root-tag of your Text component?

 xmlns:adobe="http://www.adobe.com/2009/flexUnitUIRunner"

I would recommend to change it to:

 xmlns:flexunit="http://www.adobe.com/2009/flexUnitUIRunner"

Then you would have to use it like this:

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

Based on the error message, I would assume that this is a namespace problem. If the classes were generally not available, your IDE should be presenting you lots of errors at the import statements.

Chris

Eclipse (in my case STS) complains that the following folder cannot be found: "C:\Program Files\Adobe\Adobe Flash Builder 4.7\eclipse\plugins\com.adobe.flexbuilder.flexunit_4.7.0.349722\flexunitSwcs\4.5\locale\en_US\version4locale\"

With the installation there is a folder "C:\Program Files\Adobe\Adobe Flash Builder 4.7\eclipse\plugins\com.adobe.flexbuilder.flexunit_4.7.0.349722\flexunitSwcs\4.5\locale\en_US" with one file "FlexUnitTestRunner_rb.swc" in it. By creating a sub-folder version4locale, and copying the file "FlexUnitTestRunner_rb.swc" into it did not fix the problem in the flex project. However, deleting the project and reimporting it from SVN repository fixed it.

So, Flash Builder needs it in place before the project is created or imported. (I could not update the project setting, because it was created by an earlier version of Flash Builder; and imported from SVN. Updating the project setting caused many more errors).

Use the Project->'Clean...' function to force the Flash Builder compiler to rebuild all resources in your project

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top