
TUTORIALS POINT
Simply Easy Learning Page 98
FlexUnit Integration Example
Now Let us follow the following steps to test FlexUnit Integration in a Flex application:
Create a project with a name HelloWorld under a package com.tutorialspoint.client as explained in
the Flex - Create Application chapter.
Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged.
Create TestClass1.as test case as described above and Modify TestClass1.as as explained below.
Compile and run the application to make sure business logic is working as per the requirements.
Following is the content of the modified as file src/com.tutorialspoint/client/TestClass1.as.
package com.tutorialspoint.client
{
import org.flexunit.asserts.assertEquals;
public class TestClass1
{
private var counter: int = 1;
[Before]
public function setUp():void
{
//this code will run before every test case execution
}
[After]
public function tearDown():void
{
//this code will run after every test case execution
}
[BeforeClass]
public static function setUpBeforeClass():void
{
//this code will run once when test cases start execution
}
[AfterClass]
public static function tearDownAfterClass():void
{
//this code will run once when test cases ends execution
}
[Test]
public function testCounter():void {
assertEquals(counter, 1);
}
Comentários a estes Manuais