To enable automation through SOASTA, we add Action Script functions for each of the events that we want to automate in testing.
Note: Refer to Adobe Action Script documentation for Action Script conventions.
You can download an archive of this test application including the compiled object and its code, or access and download the individual source files as they occur in Find Out How below.
- Start by adding the following two helper functions for locating the Flex components by id in a file named testAPI.as.
- Next, add a function to select a value in the combo box by its label.
- Then add a function to click the button.
- Add a function to change the value of the text input.
- Then we inlcude testAPI.as in our mxml file and add the call to registerTestCallbacks in the onInit handler.
- At this point, the Flex component is ready to be tested by SOASTA. Compile the above .mxml and .as files to create FlexAUT.swf. Add the Flex object to an html page with an id of FlexAUT.
- Create a target to test the HTML page and then create a clip that uses that target.
In the Clip Editor, add "flexAction" actions to invoke the automation methods defined above.
- For the selectByLabel and setTextInput functions, which both have 2 parameters, those parameters are separated by an '@' symbol.