lovelysystems / robotframework-androidlibrary

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

Getting error while trying to execute robotframework-androidlibrary-master\tests\apidemos\apidemos.txt #40

Closed sps7 closed 11 years ago

sps7 commented 11 years ago

Hi ,

I am new to Robotframework, now a days I am trying to automate my Android app using robotframework-androidlibrary. I am able to setup robotframework-androidlibrary on top of robotframework. And now I am trying to execute sample testcase robotframework-androidlibrary-master\tests\apidemos\apidemos.txt (taken from github.com/lovelysystems/robotframework-androidlibrary/), and i am getting below issues, please help in to solve it,

Issue 1: When trying to create emulator (keyword : Create Android Virtual Device) getting below error:

TEST SUITE: Apidemos Expand All 
Full Name: Apidemos 
Source: file:///C:/AndroidProject/tests/useit/apidemos.txt">C:\AndroidProject\tests\useit\apidemos.txt 
Start / End / Elapsed: 20130117 11:48:29.875 / 20130117 11:48:30.203 / 00:00:00.328 
Status: 7 critical test, 0 passed, 7 failed
7 test total, 0 passed, 7 failed 
Message: Suite setup failed:
255 != 0 

-SETUP: __init__.Setup Suite Expand All 
Start / End / Elapsed: 20130117 11:48:30.140 / 20130117 11:48:30.187 / 00:00:00.047 

+KEYWORD: __init__.Android SDK Should Exist Expand All 
Documentation: simple sanity check to see if D:\ANDROID_HOME\Android\android-sdk was set correctly

Start / End / Elapsed: 20130117 11:48:30.140 / 20130117 11:48:30.140 / 00:00:00.000 

-KEYWORD: __init__.Create Android Virtual Device Expand All 
Start / End / Elapsed: 20130117 11:48:30.140 / 20130117 11:48:30.187 / 00:00:00.047 

-KEYWORD: variables.Execute echo "no" | %{ANDROID_HOME}/tools/android --silent create avd --name ${EMULATOR_NAME} --force -t android-${API_LEVEL} --abi x86 Expand All 
Start / End / Elapsed: 20130117 11:48:30.140 / 20130117 11:48:30.187 / 00:00:00.047 

-KEYWORD: ${rc}, ${output} = OperatingSystem.Run And Return Rc And Output ${command} Expand All 
Documentation: Runs the given command in the system and returns the RC and output.

Start / End / Elapsed: 20130117 11:48:30.140 / 20130117 11:48:30.187 / 00:00:00.047 
11:48:30.140 INFO Running command 'echo "no" | D:\ANDROID_HOME\Android\android-sdk/tools/android --silent create avd --name My-Emulator --force -t android-16 --abi x86 2>&1' 
11:48:30.187 INFO ${rc} = 255 
11:48:30.187 INFO ${output} = 'D:\ANDROID_HOME\Android\android-sdk' is not recognized as an internal or external command,
operable program or batch file. 
-KEYWORD: BuiltIn.Should Be Equal As Integers ${rc}, 0 Expand All 
Documentation: Fails if objects are unequal after converting them to integers.

Start / End / Elapsed: 20130117 11:48:30.187 / 20130117 11:48:30.187 / 00:00:00.000 
11:48:30.187 INFO Argument types are:
<type 'int'>
<type 'unicode'> 
11:48:30.187 FAIL 255 != 0 

-TEARDOWN: AndroidLibrary.Stop Emulator Expand All 
Documentation: Halts a previously started Android Emulator.

Start / End / Elapsed: 20130117 11:48:30.203 / 20130117 11:48:30.203 / 00:00:00.000 
11:48:30.203 WARN Could not stop Android Emulator: It was not started. 
peritus commented 11 years ago

One issue is probably that the test case only works on unix (we run them on Mac OS X as well as Linux), because, for example

echo "no" | D:\ANDROID_HOME\Android\android-sdk/tools/android

has mixed path separators (see #41 fixing that) and relies on a unix-environment.

The library itself works on windows and we're using that to test our internal applications.

You could try running this testcase in cygwin or a virtual machine running linux. Also, we'd happily accept patches that make this testcase execute natively on windows.

sps7 commented 11 years ago

Hi Peritus,

Thanks for quick reply, by reading 'Make apidemos test a little more windows friendly (/ -> ${/})' the above problem got solved. But now I am getting different issue. Issue 1: Started failing at Keyword 'Build Instrumentation App' at line calabash-android build ApiDemos.apk. and not abke to put .apk file inside test_severs. MySolution: I fixed that by removing: '-sigalg MD5withRSA -digestalg SHA1 ' from C:\Ruby193\lib\ruby\gems\1.9.1\gems\calabash-android-0.3.2\bin\calabash-android-build.rb

and then I got 2nd issue: Even in log file Keyword 'Install App' is not showing any error, but I am not able to see app installed in emulator. below is log file for your reference:

TEST SUITE: Apidemos Expand All 
Full Name: Apidemos 
Source: file:///C:/AndroidProject/tests/useit/apidemos.txt">C:\AndroidProject\tests\useit\apidemos.txt 
Start / End / Elapsed: 20130118 12:02:06.296 / 20130118 12:06:39.703 / 00:04:33.407 
Status: 7 critical test, 0 passed, 7 failed
7 test total, 0 passed, 7 failed 
Message: Suite setup failed:
WindowsError: [Error 5] Access is denied

Also suite teardown failed:
WindowsError: [Error 5] Access is denied 

-SETUP: __init__.Setup Suite Expand All 
Start / End / Elapsed: 20130118 12:02:06.437 / 20130118 12:06:39.687 / 00:04:33.250 

-KEYWORD: __init__.Android SDK Should Exist Expand All 
Documentation: simple sanity check to see if D:\ANDROID_HOME\Android\android-sdk was set correctly

Start / End / Elapsed: 20130118 12:02:06.437 / 20130118 12:02:06.437 / 00:00:00.000 

-KEYWORD: OperatingSystem.File Should Exist %{ANDROID_HOME}${/}tools${/}android.bat Expand All 
Documentation: Fails unless the given `path` points to an existing file.

Start / End / Elapsed: 20130118 12:02:06.437 / 20130118 12:02:06.437 / 00:00:00.000 
12:02:06.437 INFO File 'D:\ANDROID_HOME\Android\android-sdk\tools\android.bat' exists 

-KEYWORD: __init__.Create Android Virtual Device Expand All 
Start / End / Elapsed: 20130118 12:02:06.437 / 20130118 12:02:07.531 / 00:00:01.094 

-KEYWORD: variables.Execute echo no | %{ANDROID_HOME}${/}tools${/}android --silent create avd --name ${EMULATOR_NAME} --force -t android-${API_LEVEL} --abi x86 Expand All 
Start / End / Elapsed: 20130118 12:02:06.437 / 20130118 12:02:07.531 / 00:00:01.094 

-KEYWORD: ${rc}, ${output} = OperatingSystem.Run And Return Rc And Output ${command} Expand All 
Documentation: Runs the given command in the system and returns the RC and output.

Start / End / Elapsed: 20130118 12:02:06.437 / 20130118 12:02:07.531 / 00:00:01.094 
12:02:06.453 INFO Running command 'echo no | D:\ANDROID_HOME\Android\android-sdk\tools\android --silent create avd --name My-Emulator --force -t android-16 --abi x86 2>&1' 
12:02:07.531 INFO ${rc} = 0 
12:02:07.531 INFO ${output} = Android 4.1.2 is a basic Android platform.
Do you wish to create a custom hardware profile [no]Created AVD 'My-Emulator' based on Android 4.1.2, Intel Atom (x86) processor,
with the following hardware... 

-KEYWORD: BuiltIn.Should Be Equal As Integers ${rc}, 0 Expand All 
Documentation: Fails if objects are unequal after converting them to integers.

Start / End / Elapsed: 20130118 12:02:07.531 / 20130118 12:02:07.531 / 00:00:00.000 
12:02:07.531 INFO Argument types are:
<type 'int'>
<type 'unicode'> 

-KEYWORD: ${HEADLESS_BOOL} = BuiltIn.Convert To Boolean ${HEADLESS} Expand All 
Documentation: Converts the given item to Boolean true or false.

Start / End / Elapsed: 20130118 12:02:07.531 / 20130118 12:02:07.531 / 00:00:00.000 
12:02:07.531 INFO Argument types are:
<type 'unicode'> 
12:02:07.531 INFO ${HEADLESS_BOOL} = False 

-KEYWORD: AndroidLibrary.Start Emulator ${EMULATOR_NAME}, no_window=${HEADLESS_BOOL} Expand All 
Documentation: Starts the Android Emulator.

Start / End / Elapsed: 20130118 12:02:07.531 / 20130118 12:02:53.593 / 00:00:46.062 

-KEYWORD: __init__.Pull ApiDemos.apk from Device Expand All 
Timeout: 5 minutes 
Start / End / Elapsed: 20130118 12:02:53.593 / 20130118 12:02:56.437 / 00:00:02.844 

-KEYWORD: AndroidLibrary.Wait For Device Expand All 
Documentation: Wait for the device to become available

Start / End / Elapsed: 20130118 12:02:53.593 / 20130118 12:02:53.703 / 00:00:00.110 

-KEYWORD: OperatingSystem.Remove File ApiDemos.apk Expand All 
Documentation: Removes a file with the given path.

Start / End / Elapsed: 20130118 12:02:53.703 / 20130118 12:02:53.703 / 00:00:00.000 
12:02:53.703 INFO File 'C:\AndroidProject\tests\useit\ApiDemos.apk' does not exist 

-KEYWORD: BuiltIn.Wait Until Keyword Succeeds 30 seconds, 5 seconds, Execute, %{ANDROID_HOME}${/}platform-tools${/}adb pull /data/app/ApiDemos.apk Expand All 
Documentation: Waits until the specified keyword succeeds or the given timeout expires.

Start / End / Elapsed: 20130118 12:02:53.703 / 20130118 12:02:56.437 / 00:00:02.734 

-KEYWORD: variables.Execute %{ANDROID_HOME}${/}platform-tools${/}adb pull /data/app/ApiDemos.apk Expand All 
Start / End / Elapsed: 20130118 12:02:53.703 / 20130118 12:02:56.437 / 00:00:02.734 

-KEYWORD: ${rc}, ${output} = OperatingSystem.Run And Return Rc And Output ${command} Expand All 
Documentation: Runs the given command in the system and returns the RC and output.

Start / End / Elapsed: 20130118 12:02:53.703 / 20130118 12:02:56.437 / 00:00:02.734 
12:02:53.718 INFO Running command 'D:\ANDROID_HOME\Android\android-sdk\platform-tools\adb pull /data/app/ApiDemos.apk 2>&1' 
12:02:56.437 INFO ${rc} = 0 
12:02:56.437 INFO ${output} = 1008 KB/s (2725826 bytes in 2.640s) 

-KEYWORD: BuiltIn.Should Be Equal As Integers ${rc}, 0 Expand All 
Documentation: Fails if objects are unequal after converting them to integers.

Start / End / Elapsed: 20130118 12:02:56.437 / 20130118 12:02:56.437 / 00:00:00.000 
12:02:56.437 INFO Argument types are:
<type 'int'>
<type 'unicode'> 

-KEYWORD: __init__.Re-Sign ApiDemos.apk with Debug Keystore Expand All 
Start / End / Elapsed: 20130118 12:02:56.437 / 20130118 12:02:57.984 / 00:00:01.547 

-KEYWORD: OperatingSystem.File Should Exist ApiDemos.apk Expand All 
Documentation: Fails unless the given `path` points to an existing file.

Start / End / Elapsed: 20130118 12:02:56.437 / 20130118 12:02:56.437 / 00:00:00.000 
12:02:56.437 INFO File 'C:\AndroidProject\tests\useit\ApiDemos.apk' exists 

-KEYWORD: variables.Execute zip -d ApiDemos.apk META-INF/* Expand All 
Start / End / Elapsed: 20130118 12:02:56.437 / 20130118 12:02:56.656 / 00:00:00.219 

-KEYWORD: ${rc}, ${output} = OperatingSystem.Run And Return Rc And Output ${command} Expand All 
Documentation: Runs the given command in the system and returns the RC and output.

Start / End / Elapsed: 20130118 12:02:56.437 / 20130118 12:02:56.656 / 00:00:00.219 
12:02:56.437 INFO Running command 'zip -d ApiDemos.apk META-INF/* 2>&1' 
12:02:56.656 INFO ${rc} = 0 
12:02:56.656 INFO ${output} = deleting: META-INF/MANIFEST.MF
deleting: META-INF/CERT.SF
deleting: META-INF/CERT.RSA 

-KEYWORD: BuiltIn.Should Be Equal As Integers ${rc}, 0 Expand All 
Documentation: Fails if objects are unequal after converting them to integers.

Start / End / Elapsed: 20130118 12:02:56.656 / 20130118 12:02:56.656 / 00:00:00.000 
12:02:56.656 INFO Argument types are:
<type 'int'>
<type 'unicode'> 

-KEYWORD: variables.Execute echo android| jarsigner -verbose -keystore debug.keystore ApiDemos.apk androiddebugkey Expand All 
Start / End / Elapsed: 20130118 12:02:56.656 / 20130118 12:02:57.984 / 00:00:01.328 

-KEYWORD: ${rc}, ${output} = OperatingSystem.Run And Return Rc And Output ${command} Expand All 
Documentation: Runs the given command in the system and returns the RC and output.

Start / End / Elapsed: 20130118 12:02:56.656 / 20130118 12:02:57.984 / 00:00:01.328 
12:02:56.656 INFO Running command 'echo android| jarsigner -verbose -keystore debug.keystore ApiDemos.apk androiddebugkey 2>&1' 
12:02:57.984 INFO ${rc} = 0 
12:02:57.984 INFO ${output} = Enter Passphrase for keystore:    adding: META-INF/MANIFEST.MF
   adding: META-INF/ANDROIDD.SF
   adding: META-INF/ANDROIDD.DSA
  signing: AndroidManifest.xml
  signing: assets/HelloActivity.apk
  sig... 

-KEYWORD: BuiltIn.Should Be Equal As Integers ${rc}, 0 Expand All 
Documentation: Fails if objects are unequal after converting them to integers.

Start / End / Elapsed: 20130118 12:02:57.984 / 20130118 12:02:57.984 / 00:00:00.000 
12:02:57.984 INFO Argument types are:
<type 'int'>
<type 'unicode'> 

-KEYWORD: __init__.Build Instrumentation App Expand All 
Start / End / Elapsed: 20130118 12:02:57.984 / 20130118 12:03:00.656 / 00:00:02.672 

-KEYWORD: OperatingSystem.Remove Directory ${EXECDIR}${/}test_servers${/}, recursive=True Expand All 
Documentation: Removes the directory pointed to by the given `path`.

Start / End / Elapsed: 20130118 12:02:57.984 / 20130118 12:02:57.984 / 00:00:00.000 
12:02:57.984 INFO Directory 'C:\AndroidProject\tests\useit\test_servers' does not exist 

-KEYWORD: variables.Execute calabash-android build ApiDemos.apk Expand All 
Start / End / Elapsed: 20130118 12:02:57.984 / 20130118 12:03:00.656 / 00:00:02.672 

-KEYWORD: ${rc}, ${output} = OperatingSystem.Run And Return Rc And Output ${command} Expand All 
Documentation: Runs the given command in the system and returns the RC and output.

Start / End / Elapsed: 20130118 12:02:57.984 / 20130118 12:03:00.656 / 00:00:02.672 
12:02:57.984 INFO Running command 'calabash-android build ApiDemos.apk 2>&1' 
12:03:00.656 INFO ${rc} = 0 
12:03:00.656 INFO ${output} = 
Warning: 
The signer certificate will expire within six months.
Done signing the test server. Moved it to test_servers/1d2a0e7366bcb327ad4563ac6d745008_0.3.2.apk 

-KEYWORD: BuiltIn.Should Be Equal As Integers ${rc}, 0 Expand All 
Documentation: Fails if objects are unequal after converting them to integers.

Start / End / Elapsed: 20130118 12:03:00.656 / 20130118 12:03:00.656 / 00:00:00.000 
12:03:00.656 INFO Argument types are:
<type 'int'>
<type 'unicode'> 

-KEYWORD: ${TEST_SERVERS} = OperatingSystem.List Directory ${EXECDIR}${/}test_servers${/} Expand All 
Documentation: Returns and logs items in a directory, optionally filtered with `pattern`.

Start / End / Elapsed: 20130118 12:03:00.656 / 20130118 12:03:00.656 / 00:00:00.000 
12:03:00.656 INFO Listing contents of directory 'C:\AndroidProject\tests\useit\test_servers'. 
12:03:00.656 INFO 1 item:
1d2a0e7366bcb327ad4563ac6d745008_0.3.2.apk 
12:03:00.656 INFO ${TEST_SERVERS} = [u'1d2a0e7366bcb327ad4563ac6d745008_0.3.2.apk'] 

-KEYWORD: BuiltIn.Set Global Variable ${TEST_APK}, ${TEST_SERVERS[0]} Expand All 
Documentation: Makes a variable available globally in all tests and suites.

Start / End / Elapsed: 20130118 12:03:00.656 / 20130118 12:03:00.656 / 00:00:00.000 
12:03:00.656 INFO ${TEST_APK} = 1d2a0e7366bcb327ad4563ac6d745008_0.3.2.apk 

-KEYWORD: __init__.Install App Expand All 
Timeout: 10 minutes 
Start / End / Elapsed: 20130118 12:03:00.656 / 20130118 12:06:39.671 / 00:03:39.015 

-KEYWORD: AndroidLibrary.Wait For Device Expand All 
Documentation: Wait for the device to become available

Start / End / Elapsed: 20130118 12:03:00.671 / 20130118 12:03:00.765 / 00:00:00.094 

-KEYWORD: AndroidLibrary.Uninstall Application com.example.android.apis Expand All 
Start / End / Elapsed: 20130118 12:03:00.765 / 20130118 12:05:12.093 / 00:02:11.328 

-KEYWORD: AndroidLibrary.Uninstall Application com.example.android.apis.test Expand All 
Start / End / Elapsed: 20130118 12:05:12.093 / 20130118 12:05:40.203 / 00:00:28.110 

-KEYWORD: AndroidLibrary.Install Application ${EXECDIR}${/}test_servers${/}${TEST_APK} Expand All 
Documentation: Installs the given Android application package file (APK) on the emulator along with the test server.

Start / End / Elapsed: 20130118 12:05:40.203 / 20130118 12:06:07.031 / 00:00:26.828 
-KEYWORD: AndroidLibrary.Install Application ${EXECDIR}${/}ApiDemos.apk Expand All 
Documentation: Installs the given Android application package file (APK) on the emulator along with the test server.

Start / End / Elapsed: 20130118 12:06:07.031 / 20130118 12:06:39.671 / 00:00:32.640 
-KEYWORD: AndroidLibrary.Stop Emulator Expand All 
Documentation: Halts a previously started Android Emulator.

Start / End / Elapsed: 20130118 12:06:39.671 / 20130118 12:06:39.687 / 00:00:00.016 
12:06:39.687 FAIL WindowsError: [Error 5] Access is denied 

-TEARDOWN: AndroidLibrary.Stop Emulator Expand All 
Documentation: Halts a previously started Android Emulator.

Start / End / Elapsed: 20130118 12:06:39.703 / 20130118 12:06:39.703 / 00:00:00.000 
12:06:39.703 FAIL WindowsError: [Error 5] Access is denied 

to verify installation  I tried to do it using command and then got below error: INSTALL_PARSE_FAILED_NO_CERTIFICATES

Please help me. I am running on winxp with JDK 1.7_5

peritus commented 11 years ago

You could try to run Robot Framework with -L TRACE to get a more meaningful stack trace.

sps7 commented 11 years ago

I am running using RIDE.

thachbuu commented 11 years ago

Hi sps7, I also use RIDE to run AndroidLibrary, but i meet error "WindowsError: [Error 5] Access is denied" after execute command "Start Emulator ${EMULATOR_NAME} no_window=${HEADLESS_BOOL}" I install Ruby2.0.0 . So you can help me? Can you give me your testsuit to run? I don't know what is wrong with my testsuit. Best regards,