← Back to team overview

ubuntu-touch-coreapps team mailing list archive

Re: [Autopilot-users] music-app testcase RuntimeError: Search criteria returned no results

 

On 07/24/2013 10:03 PM, Thomi Richards wrote:
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>
Hi Thomi,

Thanks for the wealth of information there! As much as I want to try out option two for running on my tablet, my Nexus 7 is currently stuck at boot (interminable rest at Google screen) after running autopilot music_app tests with my Nexus 7 plugged into my development laptop yesterday. I will proceed as soon as my Nexus 7 is restored, an issue I'll ask on the ubuntu-phone mailing list. I scoured the web to no avail. Perhaps, you can give me some advice on restoring as well.

The runtime error resulted because I was actually missing a dependency. After installing it, the error was resolved. Instead, a MismatchError took its place, which Victor reported and I hope is resolved soon.

After reading your report [1], I'm actually itching to help out on the development of autopilot by working on the issue. Is the task doable for a novice programmer? I don't mind learning by doing.

On putting music, I'll ask Nicholas. He might know, as he suggested he did on his recent blog post on Music App testing.

By the way, I'll be inactive for the next 2 days because I'm taking a family vacation. When I return, I'll explore autopilot further and prepare myself to write a testcase. I'll also stop by on the autopilot channel. There's a lot to learn.

Thanks!

[1] https://bugs.launchpad.net/autopilot/+bug/1204771

--
John Kim
Ubuntu QA & Doc Contributor
johnkim.ubuntu@xxxxxxxxx


Follow ups

References