Automated Unit Testing of Flash Applications

Introduction

Unit testing is a well-known approach to testing different applications and it is successfully used in extreme programming. Automated unit testing is the best mixture of modern testing techniques that provide the most effective business process for software development companies.

This article explains techniques you can use to perform unit testing of Flash movies. The article also contains a sample Flash application and describes how you can easily automate unit testing of a Flash application with TestComplete.

To download the TestComplete project and the sample application, use the hyperlinks from the menu in the top right corner of the page.

What Is Unit Testing

Unit testing is an effective approach for checking the application functionality. According to this approach, you create applications and write unit tests for them simultaneously. A “unit” may be anything from a single function to an entire library. The essential point of unit testing is that only a small part of the intended application is tested.

A unit test checks how a particular application unit interacts with other application parts and modules or with the user. A unit test can be a group of methods called with particular parameter values. These methods must retrieve previously known results. The results should reflect the behavior of the tested application’s unit. If the obtained results differ from the expected results, an error notification is sent to the developer.

Unit tests are used in test-driven programming approach or Test Driven Development, which is often common with Agile development. According to this technique, tests for checking the application’s behavior are written before this behavior is implemented. There is a common scheme used in this approach and is explained further in The Test-Code-Simplify cycle chapter, pg 159, of the Extreme Programming Applied book:

  • Write a single test.
  • Compile it. It must not compile, because you haven't written the implementation code it calls.
  • Implement just enough code to get the test to compile.
  • Run the test and see if it fails.
  • Implement just enough code to get the test to pass.
  • Run the test and see if it passes.
  • Refactor for clarity and "once and only once".
  • Repeat.

We will keep to this scheme in this article.

Selecting Automated Testing Tools for Unit Testing

Flash applications can be developed according to the test-driven development approach as well as other applications. There are two possible unit testing techniques for Flash applications:

  • Create unit tests with special frameworks. For instance, the AsUnit framework

    In this case you should study the framework to be able to write tests with it. You should also make arrangements for additional features that include test automation.

  • Create and automate unit tests with TestComplete

    With TestComplete you don’t need any other tools for creating unit tests. Furthermore, you will be able to easily automate the QA testing process, even if you don’t have programming or testing experience. TestComplete provides high-level test automation as well as back end database and Unit testing.

This article uses TestComplete to create unit tests for unit testing Flash applications, but you can read more about selecting automated testing tools.

More Than a Unit Test

Usually, unit tests are created as a part of a tested application. Intended for checking the application’s internal functionality, unit tests do not cover all testing aspects that should be taken into account when creating a quality product. Using unit tests, we cannot check the application’s user interface or, for instance, integration of applications into each other and many other scenarios.

With TestComplete, we create unit tests separately from the application in a special environment. These tests are not strongly “unit” in a common meaning. However, these tests allow us to check the application’s internal methods and they are very similar to natural unit tests in behavior.

Another important aspect of using TestComplete is that you can combine different QA testing techniques for checking your application from all different sides. TestComplete supports a great number of software testing types. So, if you want to create UI tests for a movie, you can create the appropriate tests with TestComplete. If you want to connect unit tests to your regression testing process, you can also do that with TestComplete. Thereby you will save time and money that could be spent on searching for additional techniques and even exploratory testing.

Unit Testing Requirements

The following section describes the needed software and configurations used in unit testing Flash applications.

TestComplete Web Module

To test Flash applications, you need to have the TestComplete Web module installed. It provides full access to the internal methods and properties of objects in the tested Flash applications.

Supported Web Browsers and Runtimes

TestComplete supports unit testing of Flash applications run in the following web browsers:

  • Microsoft Internet Explorer ver. 7-11.
  • Mozilla Firefox ver. 24-26.
  • Google Chrome ver. 31.
  • Opera Software Opera ver. 12.10 - 12.15, 17, 18.
  • Apple Safari for Windows 5.1.7.
  • Any web browser based on the Microsoft WebBrowser control.

You can also test self-executed Flash and Flex applications and applications that run in a standalone Flash Player.

Adobe Flash Player Version

To perform unit testing, use Adobe Flash Player version 10.1.102.64 or later. You can download the latest version of Adobe Player from Adobe’s web site: http://get.adobe.com/flashplayer/.

Special Global Security Settings

Testing Flash applications locally is allowed only for trusted locations, so, to be able to call ActionScript methods from TestComplete, you need to configure your Flash security settings.

If you are testing a Flash application that is located on a hard drive, you need to add the application’s location to the Trusted Locations list. You can do this in any of the following ways:

  • From the project properties by adding the needed files and folders to the Trusted Locations list of the Flash/Flex Options dialog. When you start recording or run a test, TestComplete automatically adds these files and folders to Flash Player's list of trusted locations. To open the Flash/Flex Options dialog, go to the Project Properties, click the Open Applications folder and select the Flash/flex tab.
  • From scripts by using the AddTrustedLocation method of the Options.FlashSettings object.
  • Manually from the Control Panel:
    • Open the Control Panel | System and Security | Flash Player applet. You can also right-click somewhere within any Flash or Flex movie opened in a web browser (or in Flash Player standalone) and choose Global Settings from the context menu.
    • In the ensuing Flash Player Settings Manager, switch to the Advanced tabbed page and click the Trusted Location Settings button. This will invoke the Trusted Location Settings dialog.
    • In the Trusted Location Settings dialog, select Add and specify the path to the folder where your tested application is located and click Confirm.

This will add the folder containing desired files to the list of trusted locations.

If you have a Flash Player version earlier than 11, use the online version of the Adobe Flash Player Settings Manager to specify the list of trusted locations. To open the Global Security Settings panel where you can specify the list of trusted locations, navigate to the following URL:

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

After the location has been specified, we can test Flash applications stored in this folder C:\Users\Public\Documents\Flash.

Calling ActionScript Methods From TestComplete

TestComplete has access to class methods defined in Flash applications, which are written in ActionScript. Using a scripting language in TestComplete, you can call ActionScript functions in a Flash Player. ActionScript functions can return a value, and TestComplete receives it immediately as the return value of the call.

TestComplete can receive values of simple data types that can be returned by ActionScript methods:

  • Boolean
  • Number
  • String
  • Date
  • Char

Note that you can also call JavaScript functions defined within HTML pages from TestComplete tests. This allows you not only to test Flash applications, but also to test the whole web page where the movie is.

Making ActionScript Methods Available to TestComplete

There are two ways to make ActionScript methods available to TestComplete’s test engine:

  • Using TestComplete’s FlexObject property – TestComplete automatically adds this property to all test objects that correspond to visual objects in your Flash application. It provides access to native methods and properties of Flash objects. Note that to be able to access Flash internals via the FlexObject property, you must prepare your Flash application for testing. This approach is supported for both the Internet Explorer and Mozilla Firefox browsers. Flash applications under test must be created with ActionScript 3.0 or later.

    If you use this approach, you can create a visual object in your Flash application, add desired ActionScript methods to this object and call them in your tests through the FlexObject property.

  • Using the ExternalInterface class - You can expose ActionScript methods by using the ExternalInterface class in your tested application.

    Unit testing of Flash applications exposed with the ExternalInterface class is supported only for Internet Explorer. The tested Flash application must be created with ActionScript 2.0 or later.

Let us examine the two approaches more closely.

Calling ActionScript Methods via the FlexObject Property

If your Flash application is created with ActionScript 3.0 or later, you can use the FlexObject property to perform unit testing of ActionScript methods.

Note: If your Flash application is created with ActionScript 2.0, you need to use the ExternalInterface class for unit testing.

The FlexObject property allows accessing native members of Flash application objects and calling them from your tests. Use the native methods to call ActionScript methods you want to test:

  • Create a visual object in your Flash application.
  • Add a method that either calls the desired ActionScript method or returns an object belonging to the ActionScript class to the created object.

For example, create a simple MyFlashObject class that has the NumberToString method:

//ActionScript 3.0
 import flash.display.Sprite;

public class MyFlashObject extends Sprite

{
 

  // Public Methods:

  public function NumberToString(n: Number): String 

  {

    return n.toString();

  }

}

Now you can call the application’s NumberToString method from TestComplete script code:

//JScript
 function simpleTest() 

{ 

Browsers.Item(btIExplorer).Page("file:///C:/Users/Public/Documents/Flash/MyFlashObject/Sample.html").Object("BridgeMovie").MyFlashObject(0).FlexObject.NumberToString(5);

}

The FlexObject property in the Object Browser

In order for TestComplete to treat the Flash application as Open and allow calling native methods of Flash objects, the application or testing environment must be configured in a special way.

1. Preparing Flash Applications for Testing

There are several ways to prepare your Flash application for testing and make it open to TestComplete. For detailed information on this, see the TestComplete help. Here you will find a brief overview of the ways you can use:

  • Run your tested Flash application with the debug version of Abode Flash Player with the preloaded FlashInjector.swf helper module. This module is shipped with TestComplete and allows it to expose objects of any Flash application created with ActionScript 3.0.
  • Run your tested Flash application within the Runtime Loader utility shipped with TestComplete. The utility automatically makes your application open.
  • Compile your tested Flash application with the FlexClient.swc library. This library is shipped with TestComplete and allows it to expose public methods and properties of Flash application objects.

2. Calling From TestComplete Tests

After the tested application becomes open to TestComplete, each object of the application has the FlexObject property that returns the underlying Flash object and provides access to its native public members.

Note: TestComplete treats open Flash applications as open Flex applications.

Let us see how you can call ActionScript methods using the FlexObject property. The following code obtains the MyFlashObject object of the Flash application and uses the FlexObject property to call the NumberToString method of the MyFlashObject. The result value is posted to the test log.

//JScript 
 function testExternal() 

{ 

  // obtains the page with the tested Flash application 

  var page = Aliases.browser.pageSampleHtml; 

  //obtains the Flash container object 

  var flashMovie = page.objectBridgemovie; 

  //obtains the MyFlashObject object

  var flashObject = flashMovie.MyFlashObject(0);

  //obtains the underlying Flash object and calls the NumberToString method

  var str = flashObject.FlexObject.NumberToString(5);

  //posts the result value to the test log 

  Log.Message(str); 

}

You may have noticed the Aliases object in the code above. This object refers to application objects by their short names or aliases. Aliases can be created automatically when you are recording a TestComplete test or manually, from TestComplete’s UI.

Calling ActionScript Methods via the ExternalInterface Class

The ExternalInterface class enables communication between ActionScript and the Flash Player container. To call Flash methods declared in application sources (.as files) via the ExternalInterface class, you should modify your Flash application.

1. Modifying Flash Applications (in Flash IDE)

For example, we have a MyFlashObject ActionScript class which is declared in the MyFlashObject.as file and we are going to test its methods with TestComplete:

//ActionScript 3.0
 import flash.display.Sprite;

public class MyFlashObject extends Sprite

 

{
 

    public function MyFlashObject(): void {}
 

    // Public Methods:

    public function NumberToString(n: Number): String 

    {

        var str: String = n.toString();

        return str;

    }

}

To make methods of the MyFlashObject class available to TestComplete, you should perform the following actions:

  • Add the following reference at the beginning of the .as file with the class declaration:
    import flash.external.*;
  • Make the desired method external by calling the ExternalInterface.addCallback() method from the class constructor:
    //ActionScript 3.0
     class MyFlashObject
    
    {
    
      public function MyFlashObject(): void
    
      {
    
        ExternalInterface.addCallback("NumToStr",NumberToString);
    
      }
    
    }

    This code means that the MyFlashObject.NumberToString() method will be registered as the NumToStr() method of a Flash container.

2. Calling From TestComplete Tests

You can call registered methods from TestComplete tests. You can also receive variant data type values that they return. To do this, you should obtain the Flash container object and then call its method.

For instance, we have an HTML page with a Flash movie in it. The movie uses the MyFlashObject class for converting numbers into strings. This code demonstrates how to call a Flash method from an automated test script. When TestComplete invokes the flashMovie.NumToStr() method of the Flash container, the MyFlashObject.NumberToString() method will be called in the movie:

//JScript 
 function testExternal() 

{ 

  // obtaining the page with the tested Flash application 

  var page = Aliases.browser.pageSampleHtml;

  //obtaining the Flash container object 

  var flashMovie = page.objectBridgemovie; 

  //calling the MyFlashObject.NumberToString method 

  var str = flashMovie.NumToStr(5); 

  //posting the result value to the test log 

  Log.Message(str); 

}

Unit Test Sample

Let us find out how to create a simple unit test for a Flash application. The unit test will check methods of the class implemented in the application. For this example, we assume that the tested application is stored in the C:/Users/Public/Documents/Flash/ folder.

Note: In the following example we use the ExternalInterface class to access methods of the declared class. To download the Flash application we use in the example, use the link from the menu in the top right corner of the page.

1. Creating a TestComplete Test Project

All QA tests are organized into projects in TestComplete. Let’s create a new TestComplete project for our Flash application:

  • Launch TestComplete.
  • Click Create a New Project on the Start Page. The Create New Project wizard will appear.
  • On the first page of the wizard, specify the project’s name and location and click Next.
  • The next two pages of the wizard allow you to specify the type of the tested application and to add it to the project. In this article, we will add the tested application to the project in another way. So, do not specify anything on these pages, just click Next.
  • The other page allows you to specify whether your project will be using Test Visualizer. Since we are not going to use Visualizer, disable it both at recording and at playback and click Next.
  • On the last page, select a scripting language.

    In this article, test code samples are written in JScript. The JScript language is very similar to ActionScript, which is used in Flash applications. So, Flash application developers should have no problems with creating automated tests in JScript. However, you may use any preferred scripting language supported by TestComplete. You can also write tests using the keyword testing technology that does not require programming experience at all.

  • Click Finish.

TestComplete will create a new project at the specified location and display its contents in the Project Explorer panel.

After the project is created, we can add different project items to the project. Project items provide different automated testing features. We will use the Script project item for creating unit tests in it. The Script project item is added to the project by default.

TestComplete Project Structure

Preparing Assertion Functions

According to the unit testing technique, we need special methods for controlling the testing process. These methods inform us about errors that happen during the test execution and save test results to the log. These functions are usually called “assertion functions”.

The assertion functions will be defined in a separate unit. We will add a new unit to the project and name it “AssertionFunctions”. This unit will contain three routines. The isEqual() function checks whether two objects are equal. If not, it uses the equalsError() function to post the error message to the log. In the same way, the isNotEqual() function checks whether the two objects are not equal . The aqObject.GetVarType() method returns the object type code number that is used for comparing object types.

//AssertionFunctions unit 

//JScript 
 function equalsError (Actual, Expected, Msg)

{

  Log.Error(Msg+": Expected "+Expected+" , but was "+Actual); 

}
 
 function isEqual(Actual, Expected, Message) 

{

  if (aqObject.GetVarType(Expected)!= aqObject.GetVarType(Actual)) 

  {

    Log.Message("Assertion Error: Could not compare: type mismatch. Expected:"+Expected+" Actual: "+Actual);

    return; 

  }

  if (Expected != Actual)

  { 

    equalsError(Actual, Expected, Message); 

  }

  else 

  {

    Log.Message("Correct: Expected: "+Expected+" Actual: "+Actual); 

  } 

} 
 
 function isNotEqual(Actual, Expected, Message) 

{

  if (aqObject.GetVarType(Expected)!= aqObject.GetVarType(Actual)) 

  {

    Log.Message("Assertion Error: Could not compare: type mismatch. Expected:"+Expected+" Actual: "+Actual); return; 

  }

  if (Expected == Actual) 

  {

    equalsError(Actual, Expected, Message);

  } 

  else 

  { 

    Log.Message("Correct: expected: "+Expected+" Not Equal To actual: "+Actual);

  } 

}

3. Creating a Testing Class

Suppose we need a class that converts degrees from one temperature scale to another one. Let’s create a new TempConverter class in our Flash application. This class will have three methods for temperature conversion:

  • Celsius to Reaumur
  • Celsius to Fahrenheit
  • Celsius to Kelvin

Let’s create a skeleton of this class. Note that we should add the flash.external.* reference at the beginning of the class definition to be able to test its methods from TestComplete.

//ActionScript 3.0 

//TempConverter class 
 import flash.display.Sprite;
 import flash.external.*; 
 public class TempConverter extends Sprite

{

  // Initialization: 

  public function TempConverter(): void 

  { 

    //make methods available for testing with TestComplete 

    ExternalInterface.addCallback("CelsToReaum", CelsToReaum); 

    ExternalInterface.addCallback("CelsToFah", CelsToFah); 

    ExternalInterface.addCallback("CelsToKel", CelsToKel); 

  } 

  // Public Methods: 

  //Celsuis to Reaumur 

  public function CelsToReaum (CelsDeg) { } 

  //Celsuis to Fahrenheit 

  public function CelsToFah (CelsDeg) { } 

  //Celsius to Kelvin 

  public function CelsToKel (CelsDeg) { } 

}

Now we are able to call the TempConverter class’s methods after the Flash application movie has loaded to the browser.

4. Creating a Unit Test

The unit test will consist of individual test cases. Test cases check particular parts of the application that can be tested. We can create a test case for each TempConverter’s method. We will define test cases as scripting routines that check the method’s specific response to a particular set of inputs. To do this, we will add a new script unit to the TestComplete project and define testing routines in it.

At the beginning of each test case routine we obtain the HTML page (the pageOrderscontainerhtm object) with the tested Flash application on it. After that we use the reference to the Flash application’s container to call ActionScript methods from TestComplete. Note that we use aliases for application objects in our script, for instance, “pageOrderscontainerhtm” is an alias. These aliases were automatically generated when we previously recorded a simple test for the tested Flash application. However, you can also create alias names manually from TestComplete’s UI. For more information, see the TestComplete help.

The following testCelsToReaum() routine is the test case for the CelsToReam() method:

//USEUNIT AssertionFunctions 

//JScript 

//TestTempConverter unit 
 function testCelsToReaum() 

{

  Log.Message("Unit Test: Celsius To Reaumur. Test Start"); 

    // URL: C:/Users/Public/Documents/Flash/Sample.html

  var page = Aliases.browser.pageSampleHtml;

  var flashMovie = page.objectBridgemovie;

  // testing 

  isEqual(flashMovie.CelsToReaum(100),80,"Convertion Celsius to Reaumur scale is not correct"); 

  isEqual(flashMovie.CelsToReaum(120.5),96.4,"Convertion Celsius to Reaumur scale is not correct. Fractional numbers"); 

  isNotEqual(flashMovie.CelsToReaum(20),0,"Convertion Celsius to Reaumur scale is not correct. 0 is retrieved");

  Log.Message("Unit Test: Celsius To Reaumur. Test End"); 

}

Note: We use aliases for application objects in our script, for instance, "pageSampleHtml" is an alias. Aliases for tested objects are created automatically when you are recording tests. You can also specify alias names manually by using TestComplete’s UI. For more information, see the TestComplete help.

The testCelsToFah() routine is the test case for the CelsToFah() method:

//USEUNIT AssertionFunctions

//JScript

//TestTempConverter unit
 function testCelsToFah() 

{

  Log.Message("Unit Test: Celsius To Fahrenheit. Test Start"); 

  // URL: C:/Users/Public/Documents/Flash/Sample.html

  var page = Aliases.browser.pageSampleHtml;

  var flashMovie = page.objectBridgemovie; 

  // testing equality 

  isEqual(flashMovie.CelsToFah(68),20,"Convertion Celsius to Fahrenheit scale is not correct"); 

  isEqual(flashMovie.CelsToFah(113),45,"Convertion Celsius to Fahrenheit scale is not correct. Fractional numbers");

  isNotEqual(flashMovie.CelsToFah(122),70,"Convertion Celsius to Fahrenheit scale is not correct. 0 is retrieved");

  Log.Message("Unit Test: Celsius to Fahrenheit. Test End"); 

}

The last test case routine checks the CelsToKel() method:

//USEUNIT AssertionFunctions 

//JScript

//TestTempConverter unit
 function testCelsToKel() 

{

  Log.Message("Unit Test: Celsius To Kelvin. Test Start"); 

  // URL: C:/Users/Public/Documents/Flash/Sample.html

  var page = Aliases.browser.pageSampleHtml;

  var flashMovie = page.objectBridgemovie;

  // testing equality

  isEqual(flashMovie.CelsToKel(100),373,"Convertion Celsius to Kelvin scale is not correct");

  isEqual(flashMovie.CelsToKel(120.5),393.5,"Convertion Celsius to Kelvin scale is not correct. Fractional numbers");

  isNotEqual(flashMovie.CelsToKel(20),0,"Convertion Celsius to Kelvin scale is not correct. 0 is retrieved");

  Log.Message("Unit Test: Celsius to Kelvin. Test End");

}

Our unit test will consist of three routines: testCelsToReaum, testCelsToFah and testCelsToKel. It is time to automate the test execution.

Now it is time to automate the test execution.

5. Automating Unit Tests

The Flash application is tested on an actual web page, so it is useful to automate loading the web page in a browser before starting the unit test. To do that, launch Internet Explorer and open your sample web page. In this example, we use the Sample.html web page located in the C:/Users/Public/Documents/Flash folder, but the path on your machine may be different. After you open the web page, map the following objects:

  • Browsers.Item(btIExplorer) as browser,
  • Browsers.Item(btIExplorer).Page("file:///C:/Users/Public/Documents/Flash/Sample.html") as pageSampleHtml

  and

  • Browsers.Item(btIExplorer).Page("file:///C:/Users/Public/Documents/Flash/Sample.html").Object("BridgeMovie") as objectBridgemovie.

To simplify this operation, switch to the Object Browser, right-click the Browsers.Item(btIExplorer).Page("file:///C:/Users/Public/Documents/Flash/Sample.html").Object("BridgeMovie") object and select Map object in the context menu. TestComplete will show lists of parent objects to be mapped and then call the Object Name Mapping dialog where you specify mapping settings for all needed objects.

Now we should create two routines that automate starting and closing the browser:

//JScript

//BrowserActions unit 
 function startBrowser() 

{

  // loads the C:/Users/Public/Documents/Flash/Sample.html page

  Browsers.Item(btIExplorer).Run("file:///C:/Users/Public/Documents/Flash/Sample.html");

  browser = Aliases.browser;

}
 function stopBrowser() 

{

  browser.Close();

}

Note: The provided sample works with Internet Explorer. You can change the browser the test will run in by changing the parameters of the Browsers.Item operation. Note that other browsers should be prepared for web and Flash testing. To download the TestComplete project, use the link at the top right corner of the page.

If you have downloaded the sample project using the link on this page, in order for the project to run successfully, correct the path to the sample web page in your scripts. You should also keep in mind that the location where the tested Flash application is stored must be added to the list of trusted locations (see above).

After preparing all required routines, we can configure our TestComplete project for complete automation. You just need to specify the sequence of scripting routines that will be called and run the whole project. For instance, you can simply drag the needed test routines from the Code Explorer panel to the Test Items page. In our example we created the following test sequence:

Project’s Test Items

For more information on how to specify the test execution order, see the TestComplete documentation. Now the TestComplete project is completely ready to perform unit testing of our Flash sample, you just need to click the Run Project button from TestComplete’s toolbar to start testing:

Running the TestComplete project

You can schedule TestComplete project’s run and integrate it into your software development process as a part of a big automated macro. SmartBear’s Automated Build Studio can automate the whole software build, testing and release process.

6. The First Testing Act

After preparing the unit test, we should execute it for the first time and see if it fails. To do this, run the TestComplete project and view the unit test results in the test log:

Test Log: Unit Test Failed

As we expected, the unit test failed because tested methods have not been implemented yet.

7. Implementing the Testing Class

We should implement the TempConverter class’s methods so that they can pass through our unit test. To do this, open the TempConverter.as source file and add the code for temperature conversion:

//ActionScript 3.0

//TempConverter class
 import flash.display.Sprite;
 import flash.external.*; 

class TempConverter 

{

  // Initialization: 

  public function TempConverter(): void

  { 

    //make methods available for testing with TestComplete 

    ExternalInterface.addCallback("CelsToReaum", CelsToReaum); 

    ExternalInterface.addCallback("CelsToFah", CelsToFah); 

    ExternalInterface.addCallback("CelsToKel", CelsToKel); 

  }

// Public Methods: 
 public function CelsToReaum (CelsDeg: Number): Number

{ 

  return 0.8*CelsDeg;

}
 public function CelsToFah (CelsDeg: Number): Number

{

  return (5/9)*(CelsDeg-32)

} 
 public function CelsToKel (CelsDeg: Number): Number

{

  return CelsDeg+273;

}

Now the tested methods are ready to check for the correct return value results. Note that you should republish the movie after you have made changes to the application source code.

Note: You should republish the movie after you have made changes to the application source code.

8. The Second Testing Act

The second test iteration is the main check that controls the results returned by the unit testing methods. You should run the TestComplete project again to get the results:

Test Log: Unit Tests Passed Successfully

As you can see, all unit tests passed successfully. You can view the test log and make decisions on how the tested application works and whether any changes are needed. You can also easily export test results in the XML format, send them by e-mail to the result storage and view them externally in a .mht format.

Conclusion

With TestComplete you can easily create unit tests for Flash applications and automate them. This article describes how to get access to internal methods of Flash applications via the ExternalInterface class and via the FlexObject property of Flash application objects in TestComplete. If you have not tried TestComplete yet, you can download it and see how it can automate the unit testing process.