Flex FlexUnit Integration Adobe Flex

What is flexunit integration?

Flash Builder has four excellent inbuilt supports for FlexUnit integration in Flex development Cycle.

Create a Test Case Class

Test Case Class can be created using Flash Builder Create Test Class wizard.

For creating a test case class using Flash Builder, Click on File > New > Test Case Class and enter the details as shown below.

test case

Flash Builder creates bellow TestClass1.as file.

FlexUnit Integration Example

Follow below steps to test FlexUnit Integration in a Flex application:

Step

Description

1

Create a project with a name HelloWorld under a package com.wisdomjobs.client

2

Modify HelloWorld.mxml as explained below and skip rest of the files.

3

Create TestClass1.as test case as explained above and Modify TestClass1.as as explained below.

4

Compile and run the application to make sure business logic is working as per the requirements.

Below is the content of the modified as file src/com.wisdomjobs/client/TestClass1.as.

Below is the content of the modified mxml file src/com.wisdomjobs/HelloWorld.mxml.

After all the changes are done, compile and run the application in normal mode as we did in Flex - Create Application chapter.

Running Test cases

Now Right Click on TestClass1 in package explorer and select Run As > FlexUnit Tests. Below shown output will be displayed in Flash Builder test window.

flex test run

Flash Builder also displays test result in the browser.

test run

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Adobe Flex Topics