FAQ

Question List

Where can I get help?

For help with autopilot you can visit #ubuntu-autopilot on IRC. For general questions, there is also #ubuntu-quality. If you wish to chat directly with core app developers, you can do so on #ubuntu-touch. If you can't get your question answered email the ubuntu quality mailing list for help.

What do I need to develop tests?

A raring or saucy installation (VM or real) and the ubuntu-sdk packages installed. You will also need an understanding of how autopilot works (or be willing to learn Smile :-) ).

How do I run/install a core app?

Once you've branched your core app source code, you don't need to install it in order to run it. However there is a ppa with all the core apps you can install. To run the core app from source, run it like so in the root directory: qmlscene APPNAME.qml, ie qmlscene dropping-letters.qml Note, you might be missing dependencies by doing so and the app may fail to run. It's recommended to install them via a ppa to avoid this issue.

Install from ppa

In order to install from the ppa, follow the info here: https://wiki.ubuntu.com/Touch/CoreApps/PPA. You can install all of the core apps at once after adding the ppa, using the touch-coreapps meta package. sudo apt-get install touch-coreapps You can install all the core apps run them as you would any other application. After installing from the ppa, simply run the application name, ie "dropping-letters"

I received an error installing from the ppa; qtdeclarative5-* missing, etc

You are missing the ubuntu-sdk and related packages. Install them using sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper && sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get install ubuntu-sdk

Can we write tests for qml apps using autopilot using precise or quantal?

No, the ubuntu-sdk and the new version of autopilot we're utilizing both require raring and preferably saucy to work.

Where can I see an example of autopilot tests?

The tutorial on developer.ubuntu.com is an excellent first step for seeing an autopilot test in action and seeing an explanation of the test and how it works. In addition, the file manager, clock, weather, and calendar core apps already have some autopilot tests written as of this writing.

How much python does one need to know in order to write autopilot tests?

Not as much as you think Smile :-) If you are familiar with programming and can understand and use the basic autopilot functions and the ubuntu sdk emulator, writing a test won't require you to learn any fancy python.

How much should one test cover?

In general tests should be focused and specific. Test one thing per test. It's ok to logically group one set of ideas, or set of functionality per test. Just keep them simple. Tests also need to be standalone and not require any dependencies as a test should be able to run in any order. That means each test needs to do it's own setup (and teardown!) as needed.

Is there a way to pause the autopilot for say 2-3 seconds to let an action run in the background?

Using sleep is fragile and should be avoided at all costs. Instead use an assert with the eventually function to "wait" on actions that you might need to pause for.

In the example application, currency converter, how do I know that after I press the clear button, the field value should be e.g. "0.0" and not e.g. "blank"?

In the example app you know the clear value should be 0.0 from running the application and pressing the button yourself. Of course, in addition to that examining the source shows you the actions the application is to take. Looking at the CurrencyConverter.qml file we see this. The onClicked function is supposed to update the values, and we ensure in our test that indeed this occurs.

Button {

  • id: clearBtn objectName: "clearBtn" text: i18n.tr("Clear") width: units.gu(12) onClicked: {
    • inputTo.text = '0.0'; inputFrom.text = '0.0';
    }

}

Can I write an assert about a non-UI event?

Generally autopilot is utilized at a functional testing level. That said, there is nothing to prevent you from using asserts and writing tests that check things that don't appear on-screen. Perhaps clicking a button or interacting with something produces a non-UI event. You can still check for this. If there is no UI involvement in your test however, it likely would be better written as a unit test.

Should autopilot tests also test how fast the app reacts to an action? eg. check for activity indicators? or should they just focus on the actual reaction?

That depends on the application. Specific reaction timing could be useful inside a game for instance, but unless this was desired functionality autopilot doesn't care how long interactions take (you can manually set timeouts however).

Where does a method like "self.main_window.get_toolbar()" come from?

This is custom method as part of a helper class specific to that testcase. In this instance, from the main_window.py file. Autopilot has something called an emulator an application can utilize. These are generally stored in the emulators subfolder, and there may be more than one. In addition, there is often helper code inside the init.py file in the tests folder.

Can I select '''select_single''' on an object? For instance myToolbar = select_single("Toolbar"), myToolbar.select_single("SubItem")

Yes you can. This allows you to grab say a toolbar button by first grabbing the toolbar, then selecting a single button from it as you've shown.

Touch/CoreApps/Testing/FAQ (last edited 2013-07-23 05:38:02 by kotux)