UserEmulator
From Symbian Developer Community
The UserEmulator is a an on-device application which simulates user activity by generating key press and pointer input events. It is useful for automating functional, regression and stress testing, and can be used with other tools for monitoring memory use, power consumption and CPU activity over a period of time.
The UserEmulator can use an XML test script to describe events or can run in random mode. You can create the scripts using a text editor or you can use the UserEmulator to record them on a device. You can edit recorded scripts if necessary. The scripts can contain XML tags for launching applications (using the application UID or name), taking screenshots and adding markers to the log file. When the UserEmulator is running it automatically takes screenshots of panics and logs them.
Contents |
High Level Architecture
The figure shows the high level architecture of the UserEmulator. A short description of each of the components is given below.
UserEmulatorAppUI
This class handles communication with the user. It handles inputs from the user and then displays information to the user. It interfaces with the settings dialog to set and retrieve configuration information.
XML Scripts
Test scripts are written or generated in an XML format which uses simple test verbs. The scripts serve as inputs to simulate key presses or screen taps on an S60 device.
XML Parser/Script Interpreter
The Script Parser parses the XML scripts and constructs an action object for each <action> tag in the script. The Parser fails if there are any XML parsing errors and notifies the Application UI using appropriate error codes.
Action Handler
The XML Parser/Script Interpreter passes the list of action objects to the Action Handler which performs or simulates the required actions. Currently the action handler supports the following actions:
- Launching applications
- Switching between application views
- Simulating key events
- Simulating pointer events
- Closing an application
- Pausing
- Taking Screenshots
Recorder
This class records scripts. It is a windows server plug-in class that listens for key presses or screen taps from the user and records them in an XML script. Recording can be stopped by pressing the power button once on the device and the recorder must notify the UserEmulatorAppUI when recording finishes.
Scripts View
The scripts view displays all of the scripts available in the path specified in the settings dialog. Scripts can be selected to run by choosing the Mark option in the options menu. This view interfaces with the settings dialog to get the necessary configuration information.
Settings
This class handles all configuration information for the UserEmulator.
Report Generator/Logger
This logs the user journey and any system-wide panics in a file which is stored in the default log directory specified in the settings dialog. It also stores screenshots requested by script execution and screenshots of any panics in the default log directory.
RandomTest
This class is responsible for carrying out random stress tests.
Thread Notifier
This class watches all the threads and gets notifications on any thread deaths. It uses the report generator to log the details and capture screenshots.
Use Cases
Stress Test
Stress testing can be performed by using the Random Test functionality to simulate a long duration of random device and application use. Any panics which occur are captured and logged along with screenshots. The UserEmulator can perform random testing in in two modes:
- All applications: In this mode all applications available through the S60 menu system are stressed by rapidly sending keystrokes and screen taps in a random fashion. To use this mode set the settings option "Target for Random Test?" to "Off" in the *UserEmulator menu.
- Targeted applications: In this mode random testing is performed only on specified applications. The applications must be specified by UIDs in the settings dialog line "App IDs of Random Test" . The option "Target for Random Test?" must be set to "On". This test is designed to keep the intended applications in the foreground.
Stress testing can also be performed by running a set of test scripts in a loop for a long period of time.
Regression Test
Regression testing can be achieved using the UserEmulator by re-running existing scripts against a modified application to determine whether the changes break anything that worked prior to the change.
Testers can build a library of test scripts made up of standard test cases and run them on new versions of applications. Screenshots recorded during this operation can be validated against reference screenshots taken before the start of regression tests using existing PC based screen comparator tool.
Useful tips on UserEmulator
- Reset application states to its original state. Currently there is no conditional handling in the script recorder. If the applications have different startup behaviors, script execution/screenshots may differ from the actual result.
For example, Address book is empty, and you are recording a script to create a contact. Now if you execute the script on a non-empty Address book, it may produce random results. The solution to this problem is to delete the contact added during recording and reset the Adress book to its original state.
- Record multiple smaller scripts of execution and merge all the scripts into one script to complete a sequence. This is particularly useful if the icons on the device change positions due to change in the device configurations.
Info
- Enhancement entry:http://developer.symbian.org/bugs/show_bug.cgi?id=288
- Named FCL branch inside package for development: useremul
- Code for the User Emulator: https://developer.symbian.org/sfl/FCL/sftools/ana/testfw/testexecfw/useremul
- The application currently works on most S60 v3.x and S60 5.0 devices.
- Contact: user.emul@orange-ftgroup.com
Comments
Larsk said…
Stichbury 11:15, 12 November 2009 (UTC)Absolutely - thanks for the contribution. @Reshma - if you can create a user page with some details about yourself or the user emulator team, that would be a great way for people to find out more and be able to contact you. Your page is here.
Stichbury said…
I'm not convinced of the "Contributions" category - lots of stuff is contributed (the whole of the platform if you like) and I think it's not the best way to categorise this material. I think moving the material to form a sub-page of the package it is part of would be good though.
--Stichbury 16:12, 9 March 2010 (UTC)
Sign in to comment…


Orange, thank you for this contribution. It is totally OK to credit yourself here
--Larsk 11:07, 12 November 2009 (UTC)