Posted by gldnspud on the 14th of February, 2008 at 10:54 pm under Uncategorized.    This post has no comments.

I don't have time to update the HOWTOs associated with this before I end my day at the computer, but I had an ah ha! moment this evening with regard to getting FlexUnit to play nicely with RemoteObject against a PyAMF server.

Changelogs: ah ha moment, refinement and abstraction.

Files: the new test, the new class.

Some observations, where I use terminology loosely:

  • ActionScript looks superficially like Java, which is a language that I haven't used a lot, but that I've glanced at enough to notice certain patterns.

  • ActionScript is actually more like JavaScript, but has enough static typing to make it easy to follow Java idioms.

  • FlexUnit/RemoteObject samples that I've studied seem to define callback functions for asynchronous tests outside of the test case. This is unnecessary, in my opinion, and makes the test case much less readable.

    If you look at the example test above, there are five variable assignments, then a call, that comprise the entirety of the test:

    1. Line 41-42: Trigger an asynchronous operation that will produce a value object that we want to inspect.
    2. Lines 43-48: Define a function to compare the state of that object with our expectations of it.
    3. Lines 49-54: Boilerplate to connect the two together.

To me, this is a clearer way of defining tests. I hope to refine this even further by turning item 3 above into one or two lines of code.

To get to that point, my plan is to develop an API for deleting the database collection (if allowed by the server), create an empty named database, list database names, and delete a named database. That should give me enough code to figure out where the lines of fissure are to reduce that boilerplate.

Does anyone else out there know of more FlexUnit tricks? :)

Posted by gldnspud on the 12th of February, 2008 at 10:07 pm under Uncategorized.    This post has no comments.

Using Flex 3 Component without MXML:

This post is a sample AS3 code without any MXML that enables you using Flex Component in pure AS3, initializing manually Flex Application.

This should be an excellent resource for me to use tomorrow. I'm still on my quest to learn Flex and ActionScript by way of test-driven development.

So far, I have dabbled in PyAMF enough to run a remoting server that responds to remoting client code in a Python unit test, confirming that the server side is set up correctly.

The next step is to get a FlexUnit test working that does the same operation.

Not tonight, though! :)