mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 12:24:32 +00:00
109 lines
4.5 KiB
ReStructuredText
109 lines
4.5 KiB
ReStructuredText
.. _revent_files_creation:
|
|
|
|
revent
|
|
======
|
|
|
|
revent utility can be used to record and later play back a sequence of user
|
|
input events, such as key presses and touch screen taps. This is an alternative
|
|
to Android UI Automator for providing automation for workloads. ::
|
|
|
|
|
|
usage:
|
|
revent [record time file|replay file|info] [verbose]
|
|
record: stops after either return on stdin
|
|
or time (in seconds)
|
|
and stores in file
|
|
replay: replays eventlog from file
|
|
info:shows info about each event char device
|
|
any additional parameters make it verbose
|
|
|
|
Recording
|
|
---------
|
|
|
|
WA features a ``record`` command that will automatically deploy and start
|
|
revent on the target device::
|
|
|
|
wa record
|
|
INFO Connecting to device...
|
|
INFO Press Enter when you are ready to record...
|
|
[Pressed Enter]
|
|
INFO Press Enter when you have finished recording...
|
|
[Pressed Enter]
|
|
INFO Pulling files from device
|
|
|
|
Once started, you will need to get the target device ready to record (e.g.
|
|
unlock screen, navigate menus and launch an app) then press ``ENTER``.
|
|
The recording has now started and button presses, taps, etc you perform on
|
|
the device will go into the .revent file. To stop the recording simply press
|
|
``ENTER`` again.
|
|
|
|
Once you have finished recording the revent file will be pulled from the device
|
|
to the current directory. It will be named ``{device_model}.revent``. When
|
|
recording revent files for a ``GameWorkload`` you can use the ``-s`` option to
|
|
add ``run`` or ``setup`` suffixes.
|
|
|
|
For more information run please read :ref:`record-command`
|
|
|
|
|
|
Replaying
|
|
---------
|
|
|
|
To replay a recorded file, run ``wa replay``, giving it the file you want to
|
|
replay::
|
|
|
|
wa replay my_recording.revent
|
|
|
|
For more information run please read :ref:`replay-command`
|
|
|
|
Using revent With Workloads
|
|
---------------------------
|
|
|
|
Some workloads (pretty much all games) rely on recorded revents for their
|
|
execution. :class:`wlauto.common.GameWorkload`-derived workloads expect two
|
|
revent files -- one for performing the initial setup (navigating menus,
|
|
selecting game modes, etc), and one for the actual execution of the game.
|
|
Because revents are very device-specific\ [*]_, these two files would need to
|
|
be recorded for each device.
|
|
|
|
The files must be called ``<device name>.(setup|run).revent``, where
|
|
``<device name>`` is the name of your device (as defined by the ``name``
|
|
attribute of your device's class). WA will look for these files in two
|
|
places: ``<install dir>/wlauto/workloads/<workload name>/revent_files``
|
|
and ``~/.workload_automation/dependencies/<workload name>``. The first
|
|
location is primarily intended for revent files that come with WA (and if
|
|
you did a system-wide install, you'll need sudo to add files there), so it's
|
|
probably easier to use the second location for the files you record. Also,
|
|
if revent files for a workload exist in both locations, the files under
|
|
``~/.workload_automation/dependencies`` will be used in favor of those
|
|
installed with WA.
|
|
|
|
For example, if you wanted to run angrybirds workload on "Acme" device, you would
|
|
record the setup and run revent files using the method outlined in the section
|
|
above and then pull them for the devices into the following locations::
|
|
|
|
~/workload_automation/dependencies/angrybirds/Acme.setup.revent
|
|
~/workload_automation/dependencies/angrybirds/Acme.run.revent
|
|
|
|
(you may need to create the intermediate directories if they don't already
|
|
exist).
|
|
|
|
.. [*] It's not just about screen resolution -- the event codes may be different
|
|
even if devices use the same screen.
|
|
|
|
|
|
revent vs. UiAutomator
|
|
----------------------
|
|
|
|
In general, Android UI Automator is the preferred way of automating user input
|
|
for workloads because, unlike revent, UI Automator does not depend on a
|
|
particular screen resolution, and so is more portable across different devices.
|
|
It also gives better control and can potentially be faster for ling UI
|
|
manipulations, as input events are scripted based on the available UI elements,
|
|
rather than generated by human input.
|
|
|
|
On the other hand, revent can be used to manipulate pretty much any workload,
|
|
where as UI Automator only works for Android UI elements (such as text boxes or
|
|
radio buttons), which makes the latter useless for things like games. Recording
|
|
revent sequence is also faster than writing automation code (on the other hand,
|
|
one would need maintain a different revent log for each screen resolution).
|