Skip to main content
kiwiet
Participating Frequently
July 28, 2009
Answered

FlexUnit 4, Flash Builder 4, and Flex SDK 4

  • July 28, 2009
  • 2 replies
  • 5319 views

I am endeavouring to create a project using these in combination. When I created my test runner under SDK 4, it would fail while trying to initialise the test. I decided to build FlexUnit 4 with SDK 4 but it doesn't seem to find the mx name space.

Is there a version of FlexUnit 4 built for SDk 4? If not is there some rules for the conversion of a project so it can be built under SDK 4.

I know Flash Builder 4 will build FlexUnit and rune the FlexUnit TuirnKey tests if I leave it using SDK 3.2 but I am keen to get on with learning and using SDK 4.

This topic has been closed for replies.
Correct answer mlabriola

They FlexUnit 4 library can e compiled under the Flex 3 or Flex 4 SDK and works equally well under either.

The error you are seeing is actually realted to the UI runner. If you don't use that in your project, you won't have an issue. (With Flex4 you technically don't need one as the results can be reported through the FlexUnit plugin in builder)

If you do want a Flex 4 UI, there is a prototype in SVN

http://opensource.adobe.com/svn/opensource/flexunit/branches/4.x/FlexUnit4UIRunnerSpark/

however, I am sure there are several bugs as this has not been updated in a months or so, it was just a POC.

Mike

2 replies

kiwiet
kiwietAuthor
Participating Frequently
July 28, 2009

It seems that the version of FlashBuilder that I am running doesn't use the metadata. If I get it to build a testcase class then it inherits for the TestCase class and builds an MXML file that doesn't seem to do anything. I need to find an updated version that uses FlexUnit 4 protocols.

Participating Frequently
July 28, 2009

So, looking at your code, I am not sure where you are getting the [TestCase] metadata from as we don't use that.

As I mentioned before, I know there was a bug where metadata was not being correctly included in Flash Builder, however, I am not sure of a version number or any other data.

If you can correctly run these tests under the 3.xSDK though, this seems the likely cause.

Mike

Participating Frequently
July 28, 2009

Can you verify that when switching the SDK, you didn't lose the -keep-as3-metadata line from the additional compiler arguments from the FlexUnit4 library?

-keep-as3-metadata=RunWith,BeforeClass,AfterClass,Before,After,Suite,Test,Ignore,Filter,Sort,Theory,DataPoint,DataPoints,ArrayElementType

"If I get it to build a testcase class then it inherits for the TestCase class and builds an MXML file that doesn't seem to do anything"

I am not exactly sure what you mean by this, we don't inherit from a TestCase class or build any MXML files. The easiest way to find out if this is an issue with metadata data is to use the Klass reflection from FlexUnit4.

If in your main application you said

var k:Klass = new Klass( mode.TestRider );

you could then use the debugger to see if it has the metadata for the tests. If it does, then there is some other configuration problem. If it does not, then you are either missing the -keep-as3-metadata line from the FlexUnit4 library or there is a problem with builder.

Mike

mlabriolaCorrect answer
Participating Frequently
July 28, 2009

They FlexUnit 4 library can e compiled under the Flex 3 or Flex 4 SDK and works equally well under either.

The error you are seeing is actually realted to the UI runner. If you don't use that in your project, you won't have an issue. (With Flex4 you technically don't need one as the results can be reported through the FlexUnit plugin in builder)

If you do want a Flex 4 UI, there is a prototype in SVN

http://opensource.adobe.com/svn/opensource/flexunit/branches/4.x/FlexUnit4UIRunnerSpark/

however, I am sure there are several bugs as this has not been updated in a months or so, it was just a POC.

Mike

kiwiet
kiwietAuthor
Participating Frequently
July 28, 2009

Thanks Mike. That has got the UI working. Flash Builder still can't find the tests.

I am not sure I like this rating 'correct answer' on these forums. Correct implies there is only one correct solution. My experience tells me there are always multiple answers that will work. However, some answers or solutions are better than others.

Errol

Participating Frequently
July 28, 2009

Do you think you could post a reproducing case here or in the bug base for me?

If it is not finding the tests, I am concerned that it is not keeping the metadata during the compilation process. I heard rumor of such a problem, but I thought it was only external to Flash Builder. A quick test here seems to work for me, but perhaps I am doing something slightly differently.

Mike