01 March 2010 - 3.5 user guide eclipse intellij netbeans maven download nightly forum bugs blog sf.net eviware


Eviware Logo

Getting started with the AMF TestStep

Step by step tutorial

soapUI 3.5 introduces a new TestStep for sending AMF remote calls over HTTP (AMF being Adobes ActionScript Messaging Format used by Flash/Flex applications to interact with a server backend).

In out blog entry Testing AMF services with SoapUI you could see how to use a Groovy Script to simulate an AMF call. The new AMF TestStep basically lets you perform the same call without scripting and with access to all the XML-related bells-and-whistles (assertions, property-transfers, etc) In this introduction we will use the same BlazeDS platform BlazeDS and the same sample application.

Getting Started

You will need to download flexsample.jar provided here for the purpose of this tutorial (it is also included in the blaze-ds distribution). Place this jar in the %soapui%\bin\ext folder and when starting soapUI 3.5 you should see in the soapUI log that the jar has been added to the internal classpath :

The soapUI External Jar Loading

Now create a new soapUI project

Creating New SoapUI Project

and then manually add a TestSuite, a TestCase and finally add an AMF Request TestStep.

AMF Test Step Dialog

The new AMF Request window contains the following components:

For the Request:

  • 1. Endpoint
  • 2. AMF Call
  • 3. Parameters table
  • 4. Script editor
  • 5. HTTP Header inspector
  • 6. AMF Header inspector

For the Response:

  • 7. XML view
  • 8. RAW view
  • 9. Outline view
  • 10. Overview view
  • 11. HTTP Headers inspector
  • 12. AMF Header inspector

Using this window you can create calls to AMF services, first set your endpoint which for the sample application is

http://127.0.0.1:8400/samples/messagebroker/amf , then add the AMF call product.getProducts. This getPoducts method in ProductService.java doesn't require parameters so we can just submit the call, make sure both your blazeDS sample database and server are started you can submit this AMF call. Your response should look like this:

AMF Response

Now change the AMF Call to getProduct instead, which has one method parameter: the id number of product in database. Add the parameter to the parameters-table as follows:

AMF Request

Note that the order of parameters in our table should corresponds to the order of the method parameters of the AMF Call (names of your parameters in the table are not important). When submitting this call you should see something like this :

AMF Response

Now if you want to call product.create method you need to provide Product object as the method argument. So, how can you add a complex parameter of any type to the table? It is really simple with script editor; add one parameter in our parameters table named product (or whatever you want) and leave the value blank.

AMF Request

Next you use script editor to initialize new Product object and assign it to the "product" parameter.

Script editor

As you can see the script editor exposes a built in "parameters" variable which you can use for initialization of your parameter values (not only complex ones). There is also an amfHeader variable with same functionality for initializing complex objects in AMF Header inspector.

Now you can submit this call, and your response should look something like this

Response with HTTP Headers

Authorization

In soapUI 3.5 you can also login to secured AMF endpoints. For this purpose you need to do following: Open your TestCase and click on the Options button.

AMF Authorization

In the AMF tab you can set whether you need to authorize or not to an AMF service for all AMF requests in your TestCase. When choosing this you need to provide the AMD endpoint, login and password, which will be used when running the TestCase; it will login to the specified AMF service before the first TestStep and logout after last TestStep in the TestCase. The authorized AMF connection is shared among all AMF TestSteps in the Test Case.

This tutorial should get you started with the new AMF TestStep in soapUI 3.5, please don't hesitate to give us your feedback so we can make this even better!

Happy testing!