Hi,
On Thu, Jul 25, 2013 at 3:41 PM, John Kim <johnkim.ubuntu@xxxxxxxxx
<mailto:johnkim.ubuntu@xxxxxxxxx>> wrote:
My name is John, a relative newcomer to automated testcases, and I
am interested in writing autopilot testcases for core apps during
the cycle. I read all the necessary information to configure my
Ubuntu 13.04 computer and my Nexus 7 for Ubuntu Touch development.
Welcome! I'm one of the main autopilot developers, so I'll do my best
to answer your questions.
I bzr-ed all the core apps and stowed it in ~/phablet/coreapps.
My first testcase I plan to tackle is the music-app. On
launchpad, I noticed two testcases have recently been written, and
I wanted to check them out. So I navigated all the way to
*~/phablet/coreapps/music-app/tests/autopilot* and ran 'autopilot
list' on the terminal. No problems there. But when I entered
'autopilot run music...test_pause', I received several different
errors, particularly RuntimeError:('Search criteria returned no
results'). The same applied to the other two tests. All three of
them lasted 20 seconds.
http://pastebin.com/UJDZ1Hnk
I read the code, and everything seems all right, from the setup to
the tests themselves. But I need to get my facts straight.
1. Aside from ssh-ing into the Nexus 7 and installing the
testcases and running them, how can I actually run local
testcases on my Nexus 7? The Autopilot community documentation
hasn't explained this aspect. I tried bzr, but it didn't
quite work.
Your setup seems correct - that's not the source of the errors you
have found (see below). Your two options are basically:
1) Done what you've done - log in to phone with ssh (or "adb shell", I
guess but I've found that to be less reliable), get the tests, either
using bzr or installing the package, and then run them with autopilot.
I have a Nexus 7, and I just ssh'ed in, and ran "sudo apt-get install
music-app-autopilot; autopilot run music_app" [1].
2) Use the phablet-test-run script, which is part of the phablet-tools
package. Using that, you can run something like:
phablet-test-run -p music-player-autopilot music_player
on your laptop, and it'll install the autopilot test package and run
the tests. This is convenient, but often I find I want a bit more
control, and so end up SSHing in anyway.
1. Why am I receiving the RuntimeError? When I read the code, it
seems the setup has been properly done.
That particular error means that the test tried to get a part of the
application object tree, but the search criteria returned no results.
This is commonly caused because the application hasn't fully loaded,
or the tests have become out of sync with the application. [2]
1.
2. When the testcase was running, the app itself didn't pop up to
demonstrate the testcase in action.
This sounds like the application is somewhat broken - perhaps missing
a runtime dependency that's not declared in it's debian/control file?
1.
2. Finally, how can I actually put music into the Nexus 7?
That question is for someone else, I'm afraid.
If you need more help, I recommend joining the #ubuntu-touch and
#ubuntu-autopilot IRC channels on freenode. Also, autopilot has
documentation online here:
http://unity.ubuntu.com/autopilot/
Hopefully this information helps you out a bit.
Cheers!
[1] Actually, there was a dependency issue which I had to fix first.
Bug is here: https://bugs.launchpad.net/music-app/+bug/1204768
[2] Your issue has caused me to file this bug as well, you might be
interested to provide your own opinion:
https://bugs.launchpad.net/autopilot/+bug/1204771
--
Thomi Richards
thomi.richards@xxxxxxxxxxxxx <mailto:thomi.richards@xxxxxxxxxxxxx>