Skip to main content

Posts

Showing posts from May, 2008

Testing Remote Data Services with FlexUnit

This is a short example that describes an approach on testing a Flex remote data access code with FlexUnit . The access to the remote services in Flex is provided via HTTPService , WebService or RemoteObject classes. The requests to the data services are handled asynchronously. That adds a bit more complexity to the unit testing. In this example, I will share a design idea on how to test a client side of the remote data services. This is something I came up with working on my "pet" project. The "pet" project is a Web application that is based on a three tier architecture: an SQL database, a middleware part implemented with Java, Hibernate, and BlazeDS, and a client tier implemented with Flex. The example shown here works on a client side and tests access to the server-side part of the application. The tests covered in this example are designed to test a user login operation. The login operation is defined on the server-side class called UserService. public class

Building a Flex project with Ant

Here is a quick sample on how to build a simple Flex "hello world" project with Ant. The "hello world" project contains a src folder with one Flex application file and an Ant build.xml file: ./project_home/ ./src/ app.mxml build.xml The app.mxml is the main module of the project. It simply has a label with a "Hello World!" text: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Label text="Hello World!"/> </mx:Application> Here is the build.xml source: <?xml version="1.0"?> <project name="fx_practice7" default="all"> <!-- Init the build process --> <target name="init" unless="initialized"> <!-- Name of project and version --> <property name="FLEX_HOME" location="/Users/mykola/java/flex"/>

Using FlexUnit for Stress Testing

I saw quite a few questions in the forums on how to stress test a Flex application. I thought about it and came up with an idea that I want to share here. I think FlexUnit can be used for stress testing. It is not that difficult. I simply add multiple test runners for each client application and run all of them asynchronously. Here is the example of the FlexUnit runner: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" xmlns:flexunit="flexunit.flexui.*" creationComplete="onCreationComplete()"> <mx:Script> <![CDATA[ import flexunit.framework.TestSuite; import test.TemperatureConverterTest; import test.ArrayUtilTest; import mx.collections.ArrayCollection; import flexunit.flexui.TestRunnerBase; [Bindable] public var testClients:ArrayCollection; public var NUMBER_OF_TESTS:int = 100; private function onCreationComple