FlexUnit UI factory

When I started looking into how we could use flexunit in our CI build, I was struck by how the UI is closely linked to the actual running of the test suite. I really wanted to be able to use the supplied flexunit GUI out of the box – after all, it does everything the developer needs, and yet in order to have the results understood by our build process, we would need the results printed out differently.

To acheive this, my Flexunit test harness uses a factory method pattern to decide how torunthe test suite. Here’s how…

Read More »

Posted in Flash & Actionscript, Test Driven Development | Comments closed

FlexUnit for Cruise Control – XML output

If you read my earlier posts on Flex and continuous integration, you will remember that we had to do some work to get ASUnit to spit out its results in a manner that would be understood by Cruise Control. We built a log parser to parse results from the Flash players trace file into an XML file detailing the unit test results, and also a simple status file saying if the test suite succeeded or failed. Here’s how I got FlexUnit to print out results that will be understood by our parser…

Read More »

Posted in Continuous Integration, Flash & Actionscript, Test Driven Development | Comments closed

Asyncronous test setup with FlexUnit

As part of my evaluation of FlexUnit and ASUnit for continuous integration, one of the rquirements is the ability to have an asynchronous test setup. Lets say you have a class under test that requires some XML in its constructor, and ideally you want to load that XML from an external source. While this doesnt work straight out of the box for flex unit, I found a very simple way to do this. Basically, Flexunit runs its TestCases by executingthe setUp method, then runMiddle() which runs the normal test method or the next asyncronous test. So the trick here is to get runMiddle to execute only when we are ready for it. This question had come up on the Flexcoders mailing list before, and Matt Chotin suggested a possible solution. Here’s mine:

Read More »

Posted in Flash & Actionscript, Test Driven Development | Comments closed

Unit test frameworks for AS3 and Continuous Integration

Im currently evaluating FlexUnit and ASUnit as we move over to AS3 and seeing how they will fit in with our continuous integration suite. As you may have read in my previous posts on CI, we ended up significantly reworking ASUnit to get it to integrate with our needs for CI. What we are really looking for now is a framework we do not have to monkey around with too much to acheive our needs. The unit test framework we use needs to fulfil the following:

  • Simple syncronous tests
  • asynchronous tests
  • asynchronous setup (e.g. if you ned to load in some data before performing the tests)
  • printing the test result out to a log file so that Cruise Control can interpret the results
  • broadcast some sort of event when the test suite is complete so we can close the test harness and continue with the build
  • works equally well outside of the flex framework

I’ll be looking at both FlexUnit and ASUnit to see which one will work for our needs best. Ideally I would like to offer up solutions to using both so that you can fit CI into any testing framework you are currently using. I’ll post my findings as I find them, so stay posted…

Posted in Continuous Integration, Flash & Actionscript, Test Driven Development | 1 Response

Continuous Integration with Flex – Part 6

In this, the final entry on CI with Flex, I look at an extra change we made to the ASUnit sources, take a look at what CI has done for us, and finally let you in on what we are looking at next…

Read More »

Posted in Continuous Integration, Flash & Actionscript | Comments closed

Continuous Integration with Flex – Part 5

This is the penultimate installment of the CI saga, and its the last step you will need to take to get your continuous integration suite up and running. The first thing you will need to do is install CruiseControl onto your build monitoring machine. The first thing I did was get it up and running on my machine, and then re-follow my steps on a server.

CruiseControl is an open source build monitoring tool. The good thing about it is that it can be easily configured using an XML file, has plugins to lots of other tools , and has a simple to understand web based interface. I just installed from the binaries, and followed these quickstart instructions. One thing I did have to do that wasnt covered in the instructions is set an environment variable, JAVA_HOME to the location of java on my machine (in my case: C:Program FilesJavajdk1.5.0_04 ). Once you have it up and running with the simple connectfour example, we are ready to get going with our flex project.

Read More »

Posted in Continuous Integration, Flash & Actionscript | Comments closed

Continuous Integration with Flex – Part 4

Ok, so far so good. We had covered a lot of ground up to this point, but we were only part of the way there… The next step is to get our test results understood by ANT. Ikezi created a natty python script to parse the output of our flash logfile using some cunning regular expressions. Basically, it looks for a multiple line match of __TRACERUNNEROUTPUTBEGINS__(somestuff in here)__TRACERUNNEROUTPUTENDS__, then parses the match and places the test result (true / false) into a test status text file, and the XML portion into another log file.

Read More »

Posted in Continuous Integration, Flash & Actionscript | Comments closed

Continuous Integration with Flex – Part 3

So, if you have got this far, your ant build will compile the test harness, which quits after a specified period of time, and then compiles the main build. So far, so good, but it’s not really rocking yet; what we now need to do is get our ANT build to know if our unit tests have actually passed or not (and later down the line by the build monitor). The trick here is to get your swf to somehow output to a textfile that can then be read & understood by the ant build.

Read More »

Posted in Continuous Integration, Flash & Actionscript | Comments closed

Continuous Integration with Flex – Part 2

In the next step to CI Nirvana, I’m going to be looking at using ANT to build both our testHarness and the main mxml file. As I mentioned in my previous post, the job we need ANT to do is get it to compile the testHarness, wait for it to close, then compile your main build.

Read More »

Posted in Continuous Integration, Flash & Actionscript | Comments closed

Continuous Integration with Flex – Part 1

The first step for getting your CI build up and running will be to get all your basic pieces in place on your local machine.
Some of this stuff (I hope) you will already have in place, but for the sake of being complete I’ll include it here…

Read More »

Posted in Continuous Integration, Flash & Actionscript | Comments closed