Take the PIA out of load testing AMF services

Testing service APIs is a big pain. More so when you are using a format that isn’t widely supported by testing tools. Load testing AMF services…ugh.

Recently I was tasked with finding a way to load test some AMF services built using PHP. In the past I had used jMeter for load testing. So, that is where I started. jMeter is a good tool, but not for AMF. A few extensions for jMeter have been built for AMF, but they are a PIA to setup.

I found a couple of tools that have made load testing AMF serivices a snap. Both of the tools are from SmartBear, and both are open source and free to use. Bonus!

  1. Tool one: soapUI
  2. Tool two: loadUI

The following are the basic steps to get a simple load test set up:

Setting up the project

  1. Download and install soapUI (you’ll need Java too).
  2. Start up soapUI.
    soapUI Startup
  3. Create a new soapUI project – File -> ‘New soapUI Project’
  4. Name your project and click ‘OK’.
    soapUI New Project
  5. Add a new TestSuite – right-click your new project -> ‘New TestSuite’
  6. Name your TestSuite and click ‘OK’
    soapUI New TestSuite
  7. Create a new TestCase – right-click the new TestSuite -> ‘New TestCase’
  8. Name your TestCase and click ‘OK’
    soapui New TestCase
  9. Expand the Test Case
  10. Right-click ‘Test Steps’, select ‘Add Step’ -> AMF Request.
    soapui New AMF Request
  11. Your project is set up and ready-to-roll. Save it.

Configuring the AMF Request

Now that we have a request set up we need to specify the arguments for the call. The is where I had troubles with jMeter – setting up the data required proxies and additional tools. There was no where to easily create & edit AMF object to pass along in the AMF request.

Enter soapUI. Lets say we have an API method called getMonkeys(). getMonkeys() requires an array of ids that specifies what monkeys we want in the list. The name of this parameter is ‘monkeyIds’.

  1. In soapUI, right-click the AMF Request object and select ‘Open Editor’. You should see a window similar to the following:
    AMF Request Editor
  2. In the text field for ‘Endpoint’ enter your service end point. For example: http://www.thekuroko.com/Monkey/amfphp/gateway.php
  3. Enter the name of your call in the text field for the AMF Call setting: For example Monkey.getMonkeys
  4. Just under the entry for Endpoint add property to the property list for the call by clicking the ‘Add Property’ button.
    New Property Button
  5. Enter ‘monkeyIds’ as the name of the property. If the value for this property were a simple value we could enter it into the value column. We need an array though.
  6. To set the value for the property we’ll use the script window just under the property list.
  7. In the script window, enter the following to create an Array that contains the id values 1,2 & 3 and assigns that Array to the monkeyIds parameter.
    parameters[“monkeyIds”] = [1,2,3];
  8. That is it. The call for getMonkeys() is set up.
  9. To test the call click the little green arrow in the top left of the AMF Request editor.
  10. If your paths and data are set up correctly, you should see an XML formatted response in the window to the right of the Script editor.
    soapUI AMF Request Result

Creating and Running a Load Test

So now we have a test for a service, but we wanted to get some load testing done. If you’re looking for quick and simple load testing, you don’t have to go much further than soapUI itself. To create a load test in soapUI:

  1. Right-click the ‘Load Tests’ node under ‘Test Steps’ -> ‘New Load Test’
  2. Name the new load test and click ‘OK’
  3. 2 steps. That’s it, the load test is set up. You can run the test “as-is”.

Now, this is a very simple load test and there are a ton of things you can add to the test to improve it to build more useful load tests within soapUI.

Running Load Test with loadUI

The other tool I mentioned, loadUI, is built to integrate with soapUI and make load testing “easier and more efficient”.

Once loadUI is installed can you execute the test case that you set up in soapUI in loadUI.

  1. Right-click the test case, then select ‘Run with loadUI’.
  2. You will be prompted to save the project, do so.
  3. Select ‘Fixed Rate for the ‘Default Generator’ selection – this will determine how “clients” are generated for the load test.
  4. Select ‘Statistics’ for the ‘Default Statistics’ selection – this will display a graph for the load test metrics.
    loadUI Test Settings
  5. Click ‘OK’.
  6. loadUI will launch.
    loadUI Sstartup
  7. Click the ‘Play/Stop’ button to start the load test.
    load Play/Stop Button

You can play around with the Generator settings to change the rate at which clients are created to see changes in the load test results while the load test is running.
loadUI Generator

loadUI Stats

To view a report of the results you can click the ‘Summary Report’ button in the top right of the loadUI interface.
loadUI Summary Report Button

This is just a simple load test and there are plenty of additional settings, assertions and analysis tools that can be added, adjusted and tweaked to improve the validity of the load tests.

Next Steps

Our next step is to integrate the tests into our Continuous Integration (CI) system. We use Jenkins and I saw this post about Automating loadUI and Jenkins (formerly Hudson). So, in theory it can be done. I’ll let you know what we get worked out on that end when we get there.

So far, I’m pretty excited about the two tools. They are very useful, and free to boot. Hey SmartBear – you really are smart, thank you – you rule.


Adobe Camp: 1 Day, 3 Camps: 5280 Reasons to Use the Flash Platform

Rocky Mountain Adobe CampIf you haven’t heard already, the first Rocky Mountain Adobe Camp is open for registration.

The first ever, one of a kind, Rocky Mountain Adobe Camp is right here in Denver on June 22, 2009. Digital professionals at all experience levels are invited to this one-day event to participate in in-depth sessions, and unique hands-on activities taught by some of the most influential speakers in the “Flash-o-sphere”.

Want more information?
Check out http://camp.rmaug.com for event date and location as well as speaker and session info.

Use twitter?
Follow @adobecamp’s updates for more information and news.

There are some interesting sessions that will be divided between 3 different “tracks”:

  • Flash Camp: Get ready to learn best practices, discover hidden features, and extend your abilities
  • Dynamic Media Camp: Developers and content owners alike will expand their current knowledge of the Flash Media Server family
  • eLearning Camp: Trainers, staff development managers, and Human Resource professionals will all gain valuable insight for eLearning development using tools such as Adobe Connect, Adobe Captivate, and Adobe Acrobat

So pick one and register for the First Rocky Mountian Adobe Camp!

RMAUG Mini-Max Pixel Bender Presentation Files

Last night I gave an extremely fast run down on Pixel Bender to the Rocky Mountain Adobe User’s Group Mini-Max meeting last night. The presentation was the bare minimum you need to get started playing with Pixel.

I’ve got to give props to Lee Brimelow and his other site gotoandlearn.com for information used in the presentaion as well as the start file for the PixelBender class file in the Flex project.

Resource Links from the preso:


Adobe Announces the Open Screen Project

Adobe has just announced the Open Screen Project.

The Skinny:

  • Restrictions on use of the SWF and FLV/F4V specifications will be removed
  • The device porting layer APIs for Adobe Flash Player will be published
  • The Adobe Flash® Cast™ protocol and the AMF protocol for robust data services will be published
  • Licensing fees will be removed – making next major releases of Adobe Flash Player and Adobe AIR for devices free

What does it really mean? Well it could be the promise of a universal application platform and the ability to write an application and deploy it everywhere. But, we know, with the likes of Apple and Google, who haven’t really taken to the flash platform, that probably isn’t the case. To me it means that Adobe is allowing the community as a whole to participate in the direction that the flash platform takes. To develop what what the community wants and thinks needs to be developed. This is a good thing – yay Adobe and yay Flash!

A few more links to read:

Ryan Stewart



Developers: http://www.adobe.com/openscreenproject/developers/

Businesses: http://www.adobe.com/openscreenproject/businesses/

Setting up Cruisecontrol – Continuous Integration System

Setting up Cruisecontrol is a pretty simple process. Make sure you check out the Cruisecontrol site for info on getting started and installation. The basic steps are:

  1. Download the Cruisecontrol ZIP file (cruisecontrol-src-x.x.x.zip) and unzip the files to a directory on your computer. I’ve un-ziped the files to C:/cruisecontrol271
  2. Then build the Cruisecontrol code using the BAT file build.bat in {INSTALL_DIR}/main/
  3. Verify the install by running the following command in the command prompt:java -jar {INSTALL_DIR}/cruisecontrol-launcher.jarYou should get a error about a missing config file. If there are any other errors, you’ll need to figure out what’s missing (I’ve seen the missing tools.jar). Usually pretty easy things to fix though.
  4. Cruise control is set up and ready to run.

*There is also a windows installer but I like the command line install, it gives the feeling of more control.

Now you’ve got Cruisecontrol installed. In my next post, I’ll show you how we set up an ActionScript 2.0 project and build loop in Cruisecontrol.

Continuous Integration – The pieces and parts!

I finally have some time to post about our Continuous Integration (CI) set up for ActionScript 2.0 and Flex/ ActionScript 3.0 projects. To continue on from the first post, I’ll explain all of the pieces & parts that are needed to get a similar CI system rolling.

First, the parts that you’ll need for any project:

  • The project files – I’ve created a very simple same project that you can download for testing.
  • SVN REPO for your project
  • Cruisecontrol to manage the CI
  • ANT so we can build the projects – This is included in the Cruisecontrol download.
  • Java

Next if you are going to build ActionScript 2.0 projects you’ll need:

  • Flash IDE for ActionScript 2.0 projects – Yeah a little bit of a bummer. You’ll need to install the IDE on the CI server so the projects can be built. I’m sure you could set it up with MTASC, but we needed to compile in the IDE.
  • FlashCommand to build ActionScript 2.0 projects using the IDE (Mac Version) – Mike Chambers built this nifty tool and I’ve been using it for a while since I work in Eclipse with my ActionScript 2.0 projects.
  • ASUnit for unit testing your ActionScript 2.0 projects
  • The stand-alone flash player

Finally if you are going to build Flex Projects you’ll want the following:

Yeah, that seems like a lot, but once everything is set up it is easy to maintain…almost set and forget. As a note, this is all going to be set up on a PC, I’m not a Mac guys, so sorry there, but I would hope the set up would translate nicely from PC to Mac. We now have the basic moving parts of the system. In my next few posts, I’ll explain setting up the system:

  1. Setting up Cruisecontrol
  2. Setting up an ActionScript 2.0 Cruisecontrol project
  3. Setting up an Flex Cruisecontrol project
  4. Integrating ActionScript 2.0 project unit test results
  5. Integrating Flex project unit test results

I’ll also provide sample files and packages as we go so you have something to start from.

More Flexible Code – Programming to an Interface

Keep your code flexible – program to interfaces. What does this mean? Well there are a few things that we need to discuss before we can really answer that question. For this discussion you’ll need a decent understanding of Object Oriented programming…but, hey if you don’t have that it still may make some sense anyhow and you might even get something that you don’t understand explained for you as we go along.

First things first, Polymorphism – The ability for one class to stand in for another, kind of. By “kind of” I mean that by programming to an interface, a variable or property’s value can be assigned to an object that conforms to a “formal interface”, more on that in a second. This means that if you crate a property or variable that is typed to an interface – myPet:IAnimal; – (where IAnimal is the interface) that item can be any number of classes that follow the “interface” defined by IAnimal .

public var myPet:IAnimal = new Dog();
public var yourPet:IAnimal = new Fish();
public var hirPet:IAnimal = new Camel();
public var herPet:IAnimal = new Giraffe ();


Each of the classes, Dog, Fish, Camel, Giraffe must “implement” the IAnimal interface.

Okay, so what is a formal interface you say?
First off, a formal interface is a definition, some might say a contract, but I think that is confusing, of what a class’s publically accessible methods should be and what they should look like. ActionScript 3 provides a construct to create these interfaces that is very similar to classes. Basically you create the public methods, their parameters and their return types, but nothing that has to do with what happens inside the method.

public interface IAnimal
function create(p_name:String):void
function feed(p_food:Object):void
function sleep():void
Notice that there is nothing that tells you what you need to do in the methods, or anything about properties or private methods. That is determined by the needs of the class that implements the interface. This is a good point to take hold of and knock into your head:

A class has an implementation (what the class does ) and an interface (how the outside world interacts with it).

This is what allows your code to be flexible. If you program to interfaces, you can crate objects that are much more flexible and powerful by have the ability to “stand in” for any property or variable.

You can also create an “interface” through inheritance by using something called an “abstract” class. An abstract class isn’t intended for instantiation, so it is up to you to manage that. But abstract classes do allow for a default implementation (what the class does) as well as allowing for the type of interface implementation mentioned above because sub-classes inherit the interface of their parent classes.

So, keep your code flexible, program to interfaces!

Continious Integration for Flash and Flex

Lately I’ve been working with CruiseControl, a continuous integration tool, and unit testing (ASUnit and FlexUnit) for our ActionScript 2, ActionScript 3/Flex projects. With the help of a couple of some great posts from eyefodder and Peter Martin, I’ve finally come up with a nice little system that isn’t too much of a headache to set up and is very easy to maintain once it is set up.

When I get some real time, I’ll be sure to blog about the set up and give some walk-throughs on how to get everything up and running.

The basic ‘gist’ of continuous integration is:

To build your code as soon as it changes. This helps to identify problems with the source code as quickly as possible after the problem is introduced. By introducting unit tests into the build process, you add more integrity to the build as well as your code.

So, like I said as soon as I get some real time, I’ll be sure to put together some set up information.