Skip to content

An automated test bench for monitoring the power consumption of mobile apps

License

Notifications You must be signed in to change notification settings

SOMCA/hot-pepper-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hot-pepper-java

An automated test bench for asses the power consumption of Android apps (Java version).

Additional features

  • Rewrite with a strong typing language, more robust and efficient
  • Easy communication with Spoon processors
  • ...

Packages

  • hub/ : Virtual Hub platform installer
  • org.somca.adb : The Android device bridge wrapper (for the communication with the phone device)
  • org.somca.scenarios : User's scenarios support
  • org.somca.server : Naga Viper Server
  • org.somca.utils : Utils for the hole project

Environment

You need to add your sdk location into the ANDROID_HOME var
export ANDROID_HOME=.../sdk/android-sdk-linux

Calabash-Android for the user's scenarios test
Calabash-Android
Note that if you use Calabash-Android, you will need to add the INTERNET permission to your app
<uses-permission android:name="android.permission.INTERNET" />

Java version : Java 1.8 (JDK 8)

Virtual Hub Configuration

  • As Java dose not allow direct access to the hardware, you'll need to setup a Virtual Hub on the computer where Hot-pepper is used.

Virtual Hub installation(Windows)

  • Unzip the compressed file on hub/ folder
  • Run the executable on 32bits or 64bits

Virtual Hub installation(Linux)

Unzip the compressed file on hub/ folder and copy the binary to the directory /usr/sbin/ and make it executable.
cp 64bits/VirtualHub /usr/sbin/ and chmod +x /usr/sbin/VirtualHub

Copy the file startup_script/yVirtualHub to /etc/init.d/ and make it executable.
cp startup_script/yVirtualHub /etc/init.d/ and chmod +x /etc/init.d/yVirtualHub

Set this service to be started at boot (optional)
update-rc.d yVirtualHub defaults

Restart the system.

Optional

You need to create a new udev rule to run the VirtualHub without root access.

Copy the 51-yoctopuce_all.rules from udev_conf folder of the archive to /etc/udev/rules.d/
cp udev_conf/1-yoctopuce_all.rules /etc/udev/rules.d/

Restart the system.

Scenarios

Currently, Hot-pepper support Calabash and Espresso as a test suite. In order to start and stop the measurement process, you should open a TCPSocket with Naga Viper : (address = "127.0.0.1", port = 3000). At the beginning of your scenario, you must send the message "STARTED" to start the measurement. At the end of your scenario, you must send the message "END" to stop the measurement.

Rules

Below are some rules that the developer must take care in order to have the must suitable environment test :

  • no SIM data usage during the experiments,
  • the luminosity and phone volume must be set to the lowest level,
  • no dynamic wallpaper,
  • experiments must be repeated x times,
  • if the developer wants to use an automated acceptance testing tool like Calabash, it is advisable to use the ADB connection instead of the Wifi connection (for stability issue),
  • the battery must be under 100% in order to let Naga Viper stop the battery charging before the experiments,
  • the Wifi has to be shutdown when the application doesn’t require it usage,
  • if the Wifi has to be used, the developer must assure that his internet network is stable.
  • if recommended to restart the phone after each set of run to cool down the phone.

Run Hot-Pepper

usage:  [-h] [-n NRUN] -a APK -st {Calabash,Espresso,Monkey}
        [-sp SCENARIOSPATH] [-pn PACKAGETEST] [-o OUTPUT] [-lo LOGOUTPUT]

Hot-Pepper (Naga Viper), assessing Android app energy consumption

optional arguments:
  -h, --help             
                show this help message and exit
                
  -a APK, --apk APK      
                Set the location of your apk subject
                
  -st {Calabash,Espresso,Monkey}, --scenariosType {Calabash,Espresso,Monkey}
                Set the framework test type
                
  -sp SCENARIOSPATH, --scenariosPath SCENARIOSPATH
                Set the location path of your scenarios (This option is required when you use Calabash Test)
                
  -pn PACKAGETEST, --packageTest PACKAGETEST
                Set the package's app name (This option is required when you use Espresso Test)
                
  -o OUTPUT, --output OUTPUT
                Set the location path for the measurements (default: home dir)
                
  -lo LOGOUTPUT, --logOutput LOGOUTPUT
                Set the location path for the scenarios log (default: home dir)
                
   -n NRUN, --nrun NRUN   
                Define the number of run (default: 1)

TODO

  • Add the arg configuration for the server

Credits

SOMCA - Associate research team between :

License

GNU GENERAL PUBLIC LICENSE (Version 3)

About

An automated test bench for monitoring the power consumption of mobile apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages