Adding Flex Automation Capability
To enable automation through CloudTest, add Action Script functions for each of the events you want to automate in testing.
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.
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.
Expose all of the automation functions
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 CloudTest. 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.
What you should see
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.