lovelysystems / robotframework-androidlibrary

Robot Framework Automation Library for Android
29 stars 22 forks source link

Problems running apidemos.txt - EXPAT error #63

Open pandabat opened 10 years ago

pandabat commented 10 years ago

I'm a total noob at this but trying to set up automated testing on Android applications. This library seemed like it might be a good solution but I've no joy getting to run all week.

If it takes this long to get a demo working then I'm not sure how useful the tool will be but it would be nice to get something out of the effort for the week. Granted some of the earlier problems were down to config and environment but now the latest issue is appearing thus in the log.html. Don't know what to so next - so frustrated with this:

KEYWORD: AndroidLibrary.Start Testserver With Apk ApiDemos.apk Expand All Documentation:

Works only with calabash-android >= 0.3.0 Start / End / Elapsed: 20140206 17:28:51.419 / 20140206 17:28:52.554 / 00:00:01.135 17:28:52.554 FAIL ExpatError: syntax error: line 1, column 2

dalewking commented 10 years ago

Looking at the DEBUG log it appears that this library is expecting an older version of calabash-android. It tries to run this command:

/usr/bin/calabash-android extract-manifest com.loxabeauty-Signed.apk

But extract-manifest is not a valid command for calabash-android and it just spits out the usage information when you run the command at the command line. The ExPat error is because this library is trying to parse the output of that command as XML.

pandabat commented 10 years ago

Thanks Dale - we've taken a different approach with this for now so I hadn't had a chance to look at your reply properly. I see that you're running with it yourself for now anyway. I'll keep tabs on the progress of your issue and, if it gets solved, I'll hopefully get to return to a working version this in future.

juacompe commented 10 years ago

Hi @dalewking!

I'm experiencing the same error. I'm using calabash-android version 0.4.21 and robotframework-androidlibrary version 0.2.0.

$> calabash-android version
0.4.21

$> pip freeze
requests==2.2.1
robotframework==2.8.4
robotframework-androidlibrary==0.2.0
wsgiref==0.1.2

It seems to me that my calabash-android doesn't have extract-manifest command

$> calabash-android extract-manifest com.loxabeauty-Signed.apk
  Usage: calabash-android <command-name> [parameters] [options]
  <command-name> can be one of
  ...

I tried creating a simple test case as below

Library     AndroidLibrary

*** Test Cases ***

Sell With No Internet Connection
    Wait For Device
    Start Testserver With Apk  src-resigned.apk

The test was passing when I had only Wait For Device keyword. It starts failing when I add Start Testserver With Apk src-resigned.apk. I have src-resigned.apk at ./ (the folder I execute the pybot command).

I can run a feature file I created using calabash-android run src-resigned.apk and the tests are executed as expected on my target device.

I tried to read the function start_testserver_with_apk but not sure I could follow what's going on there.

Any suggestions how should I proceed?

juacompe commented 10 years ago

I found that _main_activity_from_apk is relying on calabash-android extract-manifest command. I doubt it would work with calabash version 0.4.21. I think I'm going to stick with just calabash-android for now.

Ps.

chevi commented 10 years ago

Hi, juacompe!

I suggest you to try my hint. At first run in terminal: calabash-android run src-resigned.apk -v

Than you will find in the output something like: 2014-03-16 21:37:17 - Starting test server using: 2014-03-16 21:37:17 - /home/user/android-sdk-linux/platform-tools/adb shell am instrument -e target_package com.test.activities -e main_activity com.test.activities.MainScreenActivity -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner

Copy this and paste before Start Testserver With Apk as: Run /home/user/android-sdk-linux/platform-tools/adb shell am instrument -e target_package com.test.activities -e main_activity com.test.activities.MainScreenActivity -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner

Or downgrade robotframework-androidlibrary

munsei commented 10 years ago

Hi chevi, I'm still having the same error even after adding the hint that you provided before the "Start Testserver With Apk" keyword

Any suggestions how should I proceed?

Thanks.