= Autopilot test runners = Although you can always run autopilot tests directly using the autopilot3 binary, sometimes it's easier to utilize an alternative test runner to execute your tests. '''For up-to-date information, see https://developer.ubuntu.com/en/start/platform/guides/running-autopilot-tests/'''. '''The information on this wiki page deprecated and included for informational purposes only.''' == phablet-tools == === Preparation === /!\ These commands are to be run on the host computer (not the phone itself) /!\ {{{#!highlight bash # install the latest image with enabled developer mode and a PIN set to 0000: ubuntu-device-flash --developer-mode --password 0000 --channel="ubuntu-touch/devel-proposed" # NOTE: please check in which channel your last green image actually is. # also check the exact version, use "ubuntu-device-flash -h" for the necessary flashing options. # Disable the intro: phablet-config edges-intro --disable # Disable the welcome wizard: phablet-config welcome-wizard --disable # Make image writable and reboot; only do this for testing debs, if only testing click # packages this can be skipped (note that if you use the -p or --ppa options you also need to # supply the password/PIN of the device to install packages or PPAs): phablet-config writable-image -r 0000 --ppa ppa:ci-train-ppa-service/landing-### # Run this in another terminal window and leave it running to # make sure display stays on for the tests: adb shell powerd-cli display on bright }}} == Running Deb tests == Make sure you unlock the screen on your device prior to running these commands on the host (if you use a different PIN/password than 0000 the commands below need to be adjusted accordingly): {{{#!highlight bash phablet-test-run -r 0000 -p address-book-app-autopilot address_book_app phablet-test-run -r 0000 -p cordova-ubuntu-autopilot cordova_ubuntu phablet-test-run -r 0000 -p dialer-app-autopilot dialer_app phablet-test-run -r 0000 -p mediaplayer-app-autopilot mediaplayer_app phablet-test-run -r 0000 -p messaging-app-autopilot messaging_app phablet-test-run -r 0000 -p ubuntu-keyboard-autopilot ubuntu_keyboard phablet-test-run -r 0000 -p ubuntu-system-settings-autopilot ubuntu_system_settings phablet-test-run -r 0000 -p ubuntu-ui-toolkit-autopilot ubuntuuitoolkit phablet-test-run -r 0000 -p ubuntu-html5-ui-toolkit-autopilot ubuntu_html5_ui_toolkit phablet-test-run -r 0000 -p unity-webapps-qml-autopilot unity_webapps_qml phablet-test-run -r 0000 -p webbrowser-app-autopilot webbrowser_app }}} == Running Unity8 tests on Mir == {{{#!highlight bash # 1. reboot the device # 2. wait for the device mount to settle (nautilus pops up, at that point adb connection breaks) phablet-test-run -n -r 0000 -p unity8-autopilot unity8 }}} == Running Click tests == NOTE: phablet-click-test-setup requires autopilot to be installed on the device. Installing the autopilot-touch package requires you turn on r/w mode for the image. {{{#!highlight bash # For click apps, this will download the tests for all your # preinstalled apps you can use --click for a specific package name: phablet-click-test-setup # Enable autopilot to reach the confined click apps, running this can # take a few to several minutes depending on the amount of click apps installed: phablet-config autopilot --dbus-probe enable }}} Note: This is not a comprehensive list of preinstalled click packages. For that list see http://people.canonical.com/~ubuntu-archive/click_packages/click_list {{{#!highlight bash # pulls tests # runs tests phablet-click-test-setup --click com.ubuntu.calculator; phablet-test-run ubuntu_calculator_app phablet-click-test-setup --click com.ubuntu.calendar; phablet-test-run -r 0000 -p address-book-service-dummy calendar_app phablet-click-test-setup --click com.ubuntu.clock; phablet-test-run ubuntu_clock_app phablet-click-test-setup --click com.ubuntu.dropping-letters; phablet-test-run dropping_letters_app phablet-click-test-setup --click com.ubuntu.filemanager; phablet-test-run filemanager phablet-click-test-setup --click com.ubuntu.music; phablet-test-run music_app phablet-click-test-setup --click com.ubuntu.notes; phablet-test-run notes_app phablet-click-test-setup --click com.ubuntu.terminal; phablet-test-run ubuntu_terminal_app phablet-click-test-setup --click com.ubuntu.weather; phablet-test-run ubuntu_weather_app phablet-click-test-setup --click com.ubuntu.shorts; phablet-test-run shorts_app phablet-click-test-setup --click com.ubuntu.gallery; phablet-test-run gallery_app phablet-click-test-setup --click com.ubuntu.camera; phablet-test-run camera_app # (on the device after finishing running all the tests) # clean up the downloaded tests (see notes below) adb shell rm -rf /home/phablet/autopilot }}} IMPORTANT NOTE: remember that after doing a phablet-click-test-setup, you are fetching some autopilot tests to the ~/autopilot directory on the device. The tests in this directory have priority over all other directories. This means that if a given click package test pulls in, for instance, unity8 autopilot tests (which most of them do), you need to remove the ~/autopilot directory to use the latest autopilot tests installed on the system. == Running Security tests == {{{#!highlight bash # (on the local machine) bzr branch lp:ubuntu-test-cases/touch cd touch/tests/security ./setup.sh adb push run_test.sh /tmp/ adb push qrt_tests /tmp/qrt_tests # (on the device) cd /tmp/qrt_tests # run the tests ../run_test.sh apparmor-easyprof-ubuntu ../run_test.sh check-packages ../run_test.sh click-apparmor ../run_test.sh check-ufw-kernel-requirements ../run_test.sh check-apparmor ../run_test.sh check-ufw }}} == Start Applications through adb == In almost all cases it is a good idea to also validate your work by using your phone by hand after adding your change. A convenient way for developers to do app testing is by starting them through adb. To make that convenient we are providing a cli tool, called {{{ubuntu-app-launch}}}. Syntax: {{{#!highlight bash ubuntu-app-launch }}} Examples: {{{#!highlight bash phablet-shell ubuntu-app-launch com.ubuntu.music ubuntu-app-launch dialer-app }}} == Receipts for different Developer Roles == For application developers, we highly recommend to run at least your own application autopilot before submitting code. {{{#!highlight bash # install your autopilots (example if in a package); on target: phablet-shell sudo apt-get install your-app-autopilot # unlock screen by hand and run on target through adb: phablet-test-run your_app }}} For indicator developers, we highly recommend to run at least your indicator tests, but also the unity8 test suite; also if your indicator collaborates with any application, also run their tests {{{#!highlight bash # install unity8 autopilot and two apps; on target: phablet-shell sudo apt-get install unity8-autopilot webbrowser-app-autopilot camera-app-autopilot # unlock screen by hand and run on target through adb: phablet-test-run webbrowser_app # unlock screen by hand and run on target through adb: phablet-test-run camera_app # run unity8 ( remember the -n) phablet-test-run -n unity8 }}} For core developers, we highly recommend to run unity8, three random apps and whatever your own test suites are.