Quick start

Installation

it is recommended to have a virtualenv activated

pip install magneto

Running tests

If a virtualenv is available, activate it before run

$ magneto run <TEST_DIR> --apk-path <PATH_TO_APK> --apk-package <APK_PACKAGE_NAME> --app-activity <APP_ACTIVITY>

Required:

Option Description
<TEST_DIR> Test file directory path. Usually ui_tests (Required)

Additional params:

Option Description
--app-package <APK_PACKAGE_NAME> Tested app package name. e.g. --app-package com.facebook.katana
--app-activity <APK_ACTIVITY> Tested app activity string. e.g. --app-activity com.facebook.katana.LoginActivity
-k <TEST_NAME / TAG> Run only matching tests by test name (i.e. test_my_feature) or @tag decorator (i.e. search_results)
--clean-install Uninstalls and then installs the tested apk specifies in the parameter --apk-path.
--apk-path <PATH_TO_APK> Path to tested app apk file. e.g --app-apk /Users/username/Downloads/facebook.apk. Required when using --clean-install
--device-id Points Magneto to a specific device available in adb devices
--clean-install Uninstalls and then installs the tested apk specifies in the parameter --apk-path.
--save-data-on-failure Saves failed test data such as adb logcat (logcat.log), element hierarchy (hierarchy.xml) and corresponding screen capture (screenshot.png).
--include-video-on-failure Instructs Magneto to save video capture (video.mp4) alongside the above default assets. Requires parameter --save-data-on-failure
--magneto-failed-data-dir Allows overriding the default /tmp/magneto_test_data/ directory for failed test data.
--wait-for-element-timeout Allows overriding the default 5000ms (5 seconds) element find timeout.