|
|
Using scripts to automate testingContents [Hide]The Automated Testing panel in Device Central allows you to automate testing by playing back test scripts. Test scripts can be recorded in Device Central or written in JavaScript using the Script Editor. Test scripts can be applied to single or multiple devices, allowing you to perform batch testing of your content. A Log window is displayed at the end of each automated test session, that is, after all scripts and devices have been tested. The log file displays snapshots and output from your application. To see a video tutorial about automating the testing of mobile content, visit the Adobe website at www.adobe.com/go/lrvid4063_dc. Record a test scriptYou can record almost any action you would normally perform in Device Central. For example, you can navigate through your content using the keypad and change emulation conditions using the testing panels. You can even use the Take Snapshot command (Ctrl+R/Command+R) and have this instruction included in your script. The test script actions are saved to a script file that can be played back later. Note: When recording a script, selecting different test devices
or content types will cause the script to stop recording.
Play back a single test script
While the script is running, you can skip a device or cancel the automated test, if desired. When the test completes, the Log window displays the results of the test. Note: If no device is selected and you click Play, the test runs
on the currently emulated device.
Play back multiple test scriptsTo play back multiple test scripts, the scripts must all be located in the same folder in the Automated Testing panel.
While the script is running, you can skip a device or cancel the automated test, if desired. When the test completes, the Log window displays the results of the test. Note: If no device is selected and you click Play, the test runs
on the currently emulated device.
Overwrite an existing test script
Create a folder or subfolder
Delete a test script
About the Log windowThe Log window displays the output created during an automated test, along with any snapshots taken during the test. The Log window also displays snapshots that have been created manually. The Log window appears automatically at the end of each scripted test session, or it can be displayed by clicking the Show snapshots button. Alternatively, you can use Command+L (Mac OS) or Ctrl+L (Windows). Output is displayed for each device, with the latest test or snapshot displayed at the top of the window. The Log window is cleared automatically when you Device Central exits. To retain a snapshot between sessions, use the Log window Export Snapshot as HTML option. About the Script EditorWhen you record a test script, Device Central creates a script. You can open the script and edit it manually, if desired, or you can write a script from scratch without using the recording feature. The left panel of the Script Editor displays the list of scripts, and it reflects any changes made in the Automated Testing panel list. Each script opened in the Script Editor is displayed in a tab, making it easy to cut and paste between scripts. The Actions section of the Script Editor allows you to save scripts, check scripts for syntax errors, and navigate through scripts by function. The View Options section of the Script Editor allows you to colorize the code, display line numbers, and turn on word wrapping. About test scriptsWhen you create a script, two empty functions are provided by default: the init() function and the idle() function. The init() function is called once when the script is loaded. The idle() function is called as often as possible while the script is running. An additional function, executeUpdate(), is generated for you when you record a script. The executeUpdate() function is called each time there is an update to the device screen. You can also access the Device Central JavaScript DOM directly from SWF files, by using the ExecuteJSCommand command of the fscommand() function. For example, the following commands invoke the emulator.snapshot() function and provide access to global script variables, respectively: fscommand("ExecuteJSCommand" "emulator.snapshot();");
fscommand("ExecuteJSCommand", "global_variable = 0;");
The elements of the JavaScript API are documented in the Adobe Device Central Scripted Testing API Reference. Create a test script to edit manually
Edit a test script
|