You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example that explains how to fetch the application data (APK name/URL) of the current run in examples/monkeyplayer/Scripts/interaction.py uses get_experiment(). Which, depending on the experiment's configuration, either returns the next run or a random new run, but not the current run.
Hence, there is currently no way to identify the current run and more importantly the current application. This is especially useful when one has custom Monkey Runner or ADB interactions for each application.
Currently none of the hooks of the Experiment class propagated the path and run parameters to the user scripts. Only Device and sometimes self (the experiment object itself) are propagated.
Whether the experiment is for a Native or a Web application, the respective super Experiment function will always be called with the run, path parameters. Since path contains the APK name in the case of a Native experiment, or, the URL in the case of a web experiment. It is the key variable in identifying the current application in the user scripts. Run is not that crucial as it is the run number which should be useful only for debugging, yet it could be useful in some context as after_last_run is currently not implemented.
The two possible mitigations are the following:
Instead of unpacking, propagate the entire current_run dictionary through the control flow of the program. And finally propagate it to the user scripts. Which will require heavily modifying the logic of the code throughout the entire application.
Keep the current structure and ensure all hook functions in Experiment.py (before_experiment, before_run, after_launch, interaction, before_close, after_run, after_experiment) propagate the parameters to the user scripts: self.scripts.run('HOOK', device, self, path, run, *args, **kwargs).
The resulting fix might require changing most of the example scripts and might also break compatibility with past experiments as the user scripts will receive different parameters. But with the suggested parameter order proposed in 2., only before_close and after_launch will be influenced. Of which the two extra parameters are contained in the Device parameter itself.
The text was updated successfully, but these errors were encountered:
The example that explains how to fetch the application data (APK name/URL) of the current run in examples/monkeyplayer/Scripts/interaction.py uses get_experiment(). Which, depending on the experiment's configuration, either returns the next run or a random new run, but not the current run.
Hence, there is currently no way to identify the current run and more importantly the current application. This is especially useful when one has custom Monkey Runner or ADB interactions for each application.
Currently none of the hooks of the
Experiment
class propagated thepath
andrun
parameters to the user scripts. OnlyDevice
and sometimesself
(the experiment object itself) are propagated.Whether the experiment is for a Native or a Web application, the respective super
Experiment
function will always be called with therun, path
parameters. Sincepath
contains the APK name in the case of a Native experiment, or, the URL in the case of a web experiment. It is the key variable in identifying the current application in the user scripts.Run
is not that crucial as it is the run number which should be useful only for debugging, yet it could be useful in some context as after_last_run is currently not implemented.The two possible mitigations are the following:
Instead of unpacking, propagate the entire
current_run
dictionary through the control flow of the program. And finally propagate it to the user scripts. Which will require heavily modifying the logic of the code throughout the entire application.Keep the current structure and ensure all hook functions in
Experiment.py
(before_experiment
,before_run
,after_launch
,interaction
,before_close
,after_run
,after_experiment
) propagate the parameters to the user scripts:self.scripts.run('HOOK', device, self, path, run, *args, **kwargs)
.The resulting fix might require changing most of the example scripts and might also break compatibility with past experiments as the user scripts will receive different parameters. But with the suggested parameter order proposed in 2., only before_close and after_launch will be influenced. Of which the two extra parameters are contained in the
Device
parameter itself.The text was updated successfully, but these errors were encountered: