Topic: Unit testing

Flash Builder 4.5 tip: Use a custom FlexUnit framework

Posted May 3, 2011 9:14 am
Filed under: Articles by Paul, Flash Builder, FlexUnit, Tutorials, Unit testing

I’ve been getting into unit testing and test-driven development a lot lately. Flash Builder has pretty nice support for FlexUnit, which I find to be the easiest way to include testing in my development workflow. However, one problem is that Flash Builder ships on a different schedule than FlexUnit, so when a new FlexUnit version […]

» Keep reading Flash Builder 4.5 tip: Use a custom FlexUnit framework

13 comments so far

Useful Flash Builder “Burrito” keyboard shortcuts

Posted November 12, 2010 8:18 am
Filed under: Articles by Paul, Flash Builder, Tutorials, Unit testing, Workflow

Last night I was working through “Uncle” Bob Martin’s “Bowling Game Kata” (thanks to John Lindquist for the link). I found myself going to my mouse a lot, doing things like switching between class and test case files and right-clicking to run tests. After slowing down too many times, I dug in and found a […]

» Keep reading Useful Flash Builder “Burrito” keyboard shortcuts

1 comment so far

Here are a few things that stood out to me the most in this great day at the greatest Flex conference on the planet:

  • FlexUnit 4. Wow. Big update. Very nice new features. Time to get (back) into it. (presentation by Michael Labriola)
  • Renaun Erickson’s Structured Log Testing framework. Another great, unexpected surprise. I didn’t really have plans to go to this session except that Renaun’s such a smart, friendly guy. And frankly, I’ve never really had enough interest to take a look at his work on this project so far. Boy am I glad I changed my mind. This is definitely a testing approach I can get into — much less overhead than other approaches I’ve seen. Getting going with it is only barely more work than adding trace() calls. And the result is certainly infinitely more valuable.

Considering I didn’t come to Indianapolis with any real interest in hearing more about testing…I’m surprised to find myself so excited by what I saw today. Today is a great day for Flex testing, that’s for sure.

I also got to hear some interesting ideas and future plans from Jacob Wright and Tyler Wright. (They made me a bit jealous — I wish I had a Flex programmer brother that I could see at conferences.) If you’re in Indianapolis, I recommend checking out their “write-in” session on the Flight Framework at 10am Tuesday in the Illinois East room.

Other less code-centric, but interesting, tidbits:

  • Joe Berkovitz is an avid mountain biker.
  • Ben Stucki has a sweet five-year-old daughter who likes deep-fried calamari and pasta, although she wasn’t able to finish her macaroni and cheese at Buca di Beppo, where apparently even the child meals are sized to feed 3-4 people.

Back in November 2005 (yes, 2.5 years ago!) I wrote an article about how data types and type checking work in ActionScript. ActionScript is different than many languages, in that the ActionScript compiler can be used for compile-time type checking (or not), and at runtime it is a strongly typed language, but it also has features of dynamically typed languages. This allows for some flexibility but also means that you have to be careful about testing your code (because the compiler won’t always catch everything).

My conclusion (not original by any means) was that unit testing is an important tool for ActionScript developers. I’ve tried a couple of ActionScript unit testing frameworks (ASUnit and FlexUnit). And finally getting to the point of this post, I was interested to learn today that the crew at Digital Primates is releasing an open source unit testing framework for Flex, known as “dpunit”.

(via Jesse Warden via Twitter)

I’ve been finishing up migrating my XML-RPC client library to ActionScript 3.0. First task, according to my own recommendation: write more unit tests.

Even though the unit tests I wrote for the ActionScript 2.0 version of the library used ASUnit, this time around I decided to go with the “home team” (i.e. developed by Adobe employees) solution and try out FlexUnit. Fortunately, at least for the tests I had already written, the two systems are pretty similar, so I only had a few tweaks to make to migrate them. (Too bad there wasn’t any way for me to unit-test my unit tests, to make sure they worked the same across frameworks.)

Anyway, along the way I found a couple of resources that were very helpful in getting started, especially since the FlexUnit documentation is rather sketchy (only limited API reference docs available). These were the articles that helped the most:

  • Darron Schall: How to use FlexUnit with Flex Builder 2 (A great “getting started” article. This article was actually written while Flex Builder was still in public alpha, so it’s not perfectly accurate when describing Flex Builder’s dialog boxes — but it’s close enough that it was easy to figure out.)
  • Daniel Rinehart: Asynchronous Testing with FlexUnit (Naturally, it doesn’t take long with ActionScript 3.0 before you want to test something involving events…so you need to do some asynchronous tests. The docs are no help here, and the included examples are really convoluted. I don’t know how Daniel figured it out, but I found his article very helpful for getting going with asynchronous tests.)

Articles by Type

Articles by Topic

Random Reading

Currently...

Adobe MAX 2011 Speaker H. Paul Robertson: Adobe Community Professional

Subscribe