TestRunners

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

Warning /!\ These commands are to be run on the host computer (not the phone itself) Warning /!\

   1 # install the latest image with enabled developer mode and a PIN set to 0000:
   2 ubuntu-device-flash --developer-mode --password 0000 --channel="ubuntu-touch/devel-proposed"
   3 
   4 # NOTE: please check in which channel your last green image actually is.
   5 # also check the exact version, use "ubuntu-device-flash -h" for the necessary flashing options.
   6 
   7 # Disable the intro:
   8 phablet-config edges-intro --disable
   9 
  10 # Disable the welcome wizard:
  11 phablet-config welcome-wizard --disable
  12 
  13 # Make image writable and reboot; only do this for testing debs, if only testing click 
  14 # packages this can be skipped (note that if you use the -p or --ppa options you also need to
  15 # supply the password/PIN of the device to install packages or PPAs):
  16 phablet-config writable-image -r 0000 --ppa ppa:ci-train-ppa-service/landing-###
  17 
  18 # Run this in another terminal window and leave it running to
  19 # make sure display stays on for the tests:
  20 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):

   1 phablet-test-run -r 0000 -p address-book-app-autopilot address_book_app
   2 phablet-test-run -r 0000 -p cordova-ubuntu-autopilot cordova_ubuntu
   3 phablet-test-run -r 0000 -p dialer-app-autopilot dialer_app
   4 phablet-test-run -r 0000 -p mediaplayer-app-autopilot mediaplayer_app
   5 phablet-test-run -r 0000 -p messaging-app-autopilot messaging_app
   6 phablet-test-run -r 0000 -p ubuntu-keyboard-autopilot ubuntu_keyboard
   7 phablet-test-run -r 0000 -p ubuntu-system-settings-autopilot ubuntu_system_settings
   8 phablet-test-run -r 0000 -p ubuntu-ui-toolkit-autopilot ubuntuuitoolkit
   9 phablet-test-run -r 0000 -p ubuntu-html5-ui-toolkit-autopilot ubuntu_html5_ui_toolkit
  10 phablet-test-run -r 0000 -p unity-webapps-qml-autopilot unity_webapps_qml
  11 phablet-test-run -r 0000 -p webbrowser-app-autopilot webbrowser_app

Running Unity8 tests on Mir

   1 # 1. reboot the device
   2 # 2. wait for the device mount to settle (nautilus pops up, at that point adb connection breaks)
   3 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.

   1 # For click apps, this will download the tests for all your
   2 # preinstalled apps you can use --click for a specific package name:
   3 phablet-click-test-setup
   4 
   5 # Enable autopilot to reach the confined click apps, running this can
   6 # take a few to several minutes depending on the amount of click apps installed:
   7 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

   1 # pulls tests                                                 # runs tests
   2 phablet-click-test-setup --click com.ubuntu.calculator;       phablet-test-run ubuntu_calculator_app
   3 phablet-click-test-setup --click com.ubuntu.calendar;         phablet-test-run -r 0000 -p address-book-service-dummy calendar_app
   4 phablet-click-test-setup --click com.ubuntu.clock;            phablet-test-run ubuntu_clock_app
   5 phablet-click-test-setup --click com.ubuntu.dropping-letters; phablet-test-run dropping_letters_app
   6 phablet-click-test-setup --click com.ubuntu.filemanager;      phablet-test-run filemanager
   7 phablet-click-test-setup --click com.ubuntu.music;            phablet-test-run music_app
   8 phablet-click-test-setup --click com.ubuntu.notes;            phablet-test-run notes_app
   9 phablet-click-test-setup --click com.ubuntu.terminal;         phablet-test-run ubuntu_terminal_app
  10 phablet-click-test-setup --click com.ubuntu.weather;          phablet-test-run ubuntu_weather_app
  11 phablet-click-test-setup --click com.ubuntu.shorts;           phablet-test-run shorts_app
  12 phablet-click-test-setup --click com.ubuntu.gallery;          phablet-test-run gallery_app
  13 phablet-click-test-setup --click com.ubuntu.camera;           phablet-test-run camera_app
  14 
  15 # (on the device after finishing running all the tests)
  16 # clean up the downloaded tests (see notes below)
  17 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

   1 # (on the local machine)
   2 bzr branch lp:ubuntu-test-cases/touch
   3 cd touch/tests/security
   4 ./setup.sh
   5 adb push run_test.sh /tmp/
   6 adb push qrt_tests /tmp/qrt_tests
   7 
   8 # (on the device)
   9 cd /tmp/qrt_tests
  10 # run the tests
  11 ../run_test.sh apparmor-easyprof-ubuntu
  12 ../run_test.sh check-packages
  13 ../run_test.sh click-apparmor
  14 ../run_test.sh check-ufw-kernel-requirements
  15 ../run_test.sh check-apparmor
  16 ../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:

   1 ubuntu-app-launch <DESKTOP-FILENAME>

Examples:

   1 phablet-shell
   2 
   3 ubuntu-app-launch com.ubuntu.music
   4 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.

   1 # install your autopilots (example if in a package); on target:
   2 phablet-shell
   3 sudo apt-get install your-app-autopilot
   4 
   5 # unlock screen by hand and run on target through adb:
   6 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

   1 # install unity8 autopilot and two apps; on target:
   2 phablet-shell
   3 sudo apt-get install unity8-autopilot webbrowser-app-autopilot camera-app-autopilot
   4 
   5 # unlock screen by hand and run on target through adb:
   6 phablet-test-run webbrowser_app
   7 
   8 # unlock screen by hand and run on target through adb:
   9 phablet-test-run camera_app
  10 
  11 # run unity8 ( remember the -n)
  12 phablet-test-run -n unity8

For core developers, we highly recommend to run unity8, three random apps and whatever your own test suites are.

Touch/Testing/Autopilot/TestRunners (last edited 2015-06-11 15:54:21 by 108-116-208-198)