flexunit

JUnit Eclipse plugin source-code?

Hi all, I'm looking into writing an Eclipse plugin for FlexUnit and was wondering where I could get the sources for the JUnit Eclipse plugin. I checked the JUnit sources at sourceforge but couldn't spot any code that looked like the plugin code. Any idea where this code is available? ...

flexunit with pure ActionScript project in Flex Builder 3

If you create a pure ActionScript project in Flex Builder 3 and want to do unit testing using flexunit, what is the best option? The built-in Flex builder will refuse to build the mxml file containing the TestRunnerBase component as it is a pure ActionScript project (no Flex allowed). It is impossible to add the mxml file to the "Action...

flexunit addAsync chaining

For some reason, addAsync chaining in a flexunit test as described in this article utterly fails to work when I try to do it. public function testWhatever():void { var cont:EventDispatcher = new EventDispatcher(); cont.addEventListener("continue", addAsync(verifyFirst, 1000)); cont.dispatchEvent(new Event("continue")); } pr...

Automating QA on Flex Application

I have a Flex Application that needs to be tested and our QA department is really adament on using some form of automated-testing tools like HP's QuickTest Pro (QTP). However, QTP requires that you write some custom code if you wish to automate some home-made components... Unfortunately, we have some 3rd-party components which we do not ...

Why is there no assertError() function in FlexUnit?

It seems that most XUnit testing frameworks provide assertions for the times when you want to assert that a given operation will thrown an exception (or an Error in AS3 parlance.) Is there some "standard" way of doing this that I am overlooking, which would explain the absence of an assertError() assertion included with FlexUnit? I kno...

How to set up Flex Unit 4

Does anyone know of any guides or any sort of documentation on how to set up the new Flex Builder 4 beta? I've been pulling my hair all day long, none of my tests are executed and I can't for the life of me understand what's wrong. There are no errors at all. It's as if the metadata tags are not recognized, is there some special compiler...

Configure Eclipse to run my FlexUnit tests automatically

I'd like to set up my projects in Eclipse to run FlexUnit tests everytime I save my work. I found an example with JUnit here : http://misko.hevery.com/2009/05/07/configure-your-ide-to-run-your-tests-automatically/ How would you do it? Is it possible to run FlexUnit tests without Flash Player? ...

AsUnit verses FlexUnit – which is "better"?

I'm learning ActionScript/Flex at the moment, and it's come time for me to start unit testing. My reading shows that there are two main frameworks out there: FlexUnit and AsUnit. Is there any reason to learn one over the other? Is one, in some way, "better"? ...

FlexUnit and callLater

I'm trying to use callLater with FlexUnit v0.9: public function testCallLater():void { Application.application.callLater( addAsync(function():void { assertTrue(true); }, 1000)); } but when it runs I get this error: ArgumentError: Error #1063: Argument count mismatch on flexunit.framework::AsyncTestHelper/handleEvent(). Ex...

FlexUnit Execution Time

Is there a way to know how long one test took in FlexUnit? Is there a way to know how long all tests took? ...

How can I load a local resource synchronously in Flex 3?

I want to store some test data for a FlexUnit test in small XML files in my Flex project, and access them trivially for the flex test. How can I load these bits of data synchronously? HTTPService is the way I'd be loading them _a_synchronously, but adding event handlers to my test cases seems like a bit of overkill. ...

Flex, Flexunit: How to test that an event is dispatched twice?

I'm testing some event dispatch code in a Flex app, using FlexUnit's addAsync method for testing that events are dispatched. Great so far, I can ensure that at least one event was fired. However, I want to be a bit more detailed; I want to ensure that exactly the set of events I'm expecting are dispatched. Is there a useful test patte...

Running FlexUnit4 tests in Hudson with ant

I'm just starting to try figure out how to go about continuous integration and test driven development, specifically in Flex 4. I'd like to run FlexUnit4 tests from an ant script initiated in Hudson. I can get hudson to compile my app but how do I then go about running/seeing results of my tests? ...

Best Practices for how to include unit tests in a library

I'm working on a general code library for ActionScript 3.0 called as3lib which includes several extensions to the core API and some useful functions. I've written several unit tests (using FlexUnit) to make sure everything is working correctly. What is the best way to organize these tests in the library? Currently, I have all my code in...

How can I access the test name of a FlexUnit 4 test?

In FlexUnit 1 it is possible to access the name of the currently-running test using the TestCase.getName() method because all tests subclass TestCase. In FlexUnit 4, however, there's no base class for tests; the tests are identified by annotations. So, how can I replicate the getName() functionality in FlexUnit 4? ...

FlexUnit4: [Test(expect="Error")] doesn't catch errors?

The title says it all. The following code produces a failed test, not a passing test (as I would expect): [Test(expects="Error")] public function someTest():void { throw Error("this test doesn't pass"); } ...

Flex Unit - testing a library wrapping remote objects

I'm wrapping RemoteObject inside a class for easier managing of retries, timeouts, failures and such non standard scenarios. So when wrapping a RemoteObject inside another class, how would I go about unit testing this? Here is an example of how to use the class: // set up the object as you would a RemoteObject, but without events: var...

How can I test for an event sequence in FlexUnit 4?

I have a component that, on creation, dispatches two events to populate data fields. The events should remain separate because they're used elsewhere for distinct actions. I want to write an asynchronous flexunit test to confirm that these events are both sent. The problem is, they're both variants of the same event. Here's the code: ...

FlexUnit: Alternate UI runners/listeners?

The default FlexUnit UI runner is, to put it kindly, unhelpful (sometimes I feel like it's actively hostile… But that may be a bit too harsh): error messages are constrained to two lines, the majority of the screen is a white box (that, ideally, is almost empty) and the tracebacks require an obscene amount of horizontal scrolling. So, a...

FlexUnit nested async tests

I'm trying to test some async functionality in flex 4. My test has two stages : var loader:MySuperLoader = new MySuperLoader() loader.load('foo.swf'); loader.addEventListener(Event.COMPLETE, Async.asyncHandler(this, function(e:Event):void { loader.removeEventListener(Event.COMPLETE, arguments.callee); var foo:* = loader.content;...