Appium自动化测试学习

参考链接:http://www.cnblogs.com/tangdongchu/p/4432808.html

环境搭建步骤:

1、安装appium

通过dmg安装:国内下载http://pan.baidu.com/s/1jGvAISu

2、下载android SDK

下载地址:http://pan.baidu.com/s/1hqGHhRI  ADT分多个版本,其中adt-bundle自带eclipse和sdk,推荐下载。这里我们只需要用到SDK。

3、配置环境变量

打开终端,依次输入命令

touch .bash_profile

open -e .bash_profile

自动打开文本,在文本中添加然后保存

其中ANDROID_HOME为下载的sdk存放的路径

然后在终端中输入命令

source .bash_profile

环境变量设置完成,在终端窗口输入adb回车,不显示command not found即为成功。

4、选择合适的python IDE

推荐Eclipse with PyDev、Wing ide和Sublime text

PyDev下载地址:http://pydev.org/

Wing ide下载地址:http://wingware.com/

Sublime text下载地址:http://www.sublimetext.com/

sublimetext2的python开发设置见链接:http://www.cnblogs.com/LemonTing/p/4523825.html

5、安装selenium或Appium-python-client

安装前需要先安排pip,在终端窗口输入命令:

sudo easy_install pip

然后安装appium-python-client,在终端窗口输入命令:

sudo pip install Appium-Python-Client

当然你也可以安装selenium,区别只是appium-python-client自带的方法比selenium的方法要多几个。

sudo pip install selenium -i http://pypi.douban.com/simple

此时在终端中输入python,然后输入import appium(或import selenium),如果不报错说明安装成功

6、编写appium自动化脚本

参考代码如下,appium本身是基于selenium的,因此需要用到selenium的包,unittest是用来管理case的,写case前我们需要先配置一下appium的环境,比如平台、系统版本、设备ID、安装包、启动activity、autoLaunch(是否自动安装apk并启动)等等。

设备ID获取:手机连接电脑,打开终端输入adb devices即可获得设备ID,插入android机时注意手机调试权限是否打开。

appPackge获取:连接电脑,启动应用,打开终端输入 adb shell ps可以看到应用的PackgeName appActivity获取:打开终端输入 aapt d badging Documents/python/apk/Nova_7.2.0_debug.apk 即可查看到launchActivity,其中的apk地址替换为你mac本地的apk地址

注意:aapt命令在sdks的build-tools中,因此前面配置环境变量的时候需要在路径中加入这个文件夹。

#coding=UTF-8
#! /usr/local/python
‘‘‘
Create on 2015-4-16
python 2.7 for mac
@author: tangdongchu
‘‘‘
import os
import unittest
from selenium import webdriver
import time

#Appium环境配置
PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)
)

class DpAppTests(unittest.TestCase):
    def setUp(self):
        desired_caps = {}
        desired_caps[‘platformName‘] = ‘Android‘ #设置平台
        desired_caps[‘platformVersion‘] = ‘4.2‘ #系统版本
        desired_caps[‘deviceName‘] = ‘351BBJNGTRWY‘ #设备id
        desired_caps[‘autoLaunch‘] = ‘true‘ #是否自动启动
        desired_caps[‘app‘] = PATH(
            ‘Nova_7.5.0_debug.apk‘ #安装包路径,放在该py文件的目录下
        )
        desired_caps[‘appPackage‘] = ‘com.dianping.v1‘ #包名
        desired_caps[‘appActivity‘] = ‘com.dianping.main.guide.SplashScreenActivity‘ #启动的activity

        self.driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘, desired_caps)

    def tearDown(self):
        self.driver.quit() #case执行完退出

    def test_dpApp(self): #需要执行的case
        time.sleep(15)
        el = self.driver.find_element_by_xpath("//android.widget.TextView[contains(@text,‘上海‘)]") #通过xpath找到定位框
        el.click() #点击定位框

if __name__ == ‘__main__‘:
    suite = unittest.TestLoader().loadTestsFromTestCase(DpAppTests)
    unittest.TextTestRunner(verbosity=2).run(suite) #执行case集

7、获取UI元素

将安卓机与mac相连,sdk(/home/software/adb.../sdk)目录下有个tools文件夹,其中有个uiautomator view程序,打开如下图,插入设备,点击下方左侧第二个按钮

得到的界面如下,选中元素即可看到元素的layout信息,比如下方的定位框即可以通过ID来定位,也可以通过Xpath来定位。

8、运行case,打开appium,如图

选择Android(如需在IOS上运行,本机还需安装Xcode),选择安卓系统的版本,然后launch

回到python ide,运行代码

此时查看appium窗口,会有日志输出:

Launching Appium with command: ‘/Applications/Appium.app/Contents/Resources/node/bin/node‘ lib/server/main.js --command-timeout "7200" --automation-name "Appium" --platform-name "Android" --platform-version "4.2" --app "/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk"

info: Welcome to Appium v1.3.7 (REV 72fbfaa116d3d9f6a862600ee99cf02f6d0e2182)

info: Appium REST http interface listener started on 0.0.0.0:4723
info: [debug] Non-default server args: {"app":"/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk","platformName":"Android","platformVersion":"4.2","automationName":"Appium","defaultCommandTimeout":7200}
info: Console LogLevel: debug

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}}}

info: <-- GET /wd/hub/status 200 8.248 ms - 104 {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}}}

info: <-- GET /wd/hub/status 200 3.444 ms - 104 {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}}}

info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"351BBJNGTRWY","app":"/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk","autoLaunch":"true","platformVersion":"4.2","appPackage":"com.dianping.v1","platformName":"Android","appActivity":"com.dianping.main.guide.SplashScreenActivity"}}

info: Client User-Agent string: Python-urllib/2.7
warn: Converting cap autoLaunch from string to boolean. This might cause unexpected behavior.

info: [debug] Using local app from desired caps: /Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk
info: [debug] Creating new appium session b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5
info: Starting android appium
info: [debug] Getting Java version

info: Java version is: 1.7.0_79

info: [debug] Checking whether adb is present

info: [debug] Using adb from /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb devices

info: [debug] 1 device(s) connected
info: Found device 351BBJNGTRWY
info: [debug] Setting device id to 351BBJNGTRWY
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY wait-for-device

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "echo ‘ready‘"

info: [debug] Starting logcat capture

info: [debug] Getting device API level

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "getprop ro.build.version.sdk"

info: [debug] Device is at API Level 17

info: Device API level is: 17
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "getprop persist.sys.language"

info: [debug] Current device persist.sys.language: zh

info: [debug] java -jar "/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk" "/tmp/com.dianping.v1" zh

info: [debug] No strings.xml for language ‘zh‘, getting default strings.xml

info: [debug] java -jar "/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk" "/tmp/com.dianping.v1"

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY push "/tmp/com.dianping.v1/strings.json" /data/local/tmp

info: [debug] Checking whether aapt is present

info: [debug] Using aapt from /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt dump xmltree /Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk AndroidManifest.xml

info: [debug] Set app process to: com.dianping.v1

info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for /Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk.
info: [debug] executing cmd: java -jar /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/verify.jar /Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk

info: [debug] App already signed.

info: [debug] Zip-aligning /Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/zipalign

info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/zipalign -f 4 /Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk /var/folders/5d/9kzqrtqd7tb6j4gnz2db02n00000gn/T/115426-3371-1qlz7f0/appium.tmp

info: [debug] MD5 for app is 499bbd53c2f9c045acb7587122ec535b

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "ls /data/local/tmp/499bbd53c2f9c045acb7587122ec535b.apk"

info: [debug] Getting install status for com.dianping.v1

info: [debug] Getting device API level
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "getprop ro.build.version.sdk"

info: [debug] Device is at API Level 17

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "pm list packages -3 com.dianping.v1"

info: [debug] App is installed

info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "am force-stop com.dianping.v1"

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "pm clear com.dianping.v1"

info: [debug] Forwarding system:4724 to device:4724

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY forward tcp:4724 tcp:4724

info: [debug] Pushing appium bootstrap to device...

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY push "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/android_bootstrap/AppiumBootstrap.jar" /data/local/tmp/

info: [debug] Pushing settings apk to device...

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/settings_apk/settings_apk-debug.apk"

info: [debug] Pushing unlock helper app to device...

info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk"

info: Starting App

info: [debug] Attempting to kill all ‘uiautomator‘ processes
info: [debug] Getting all processes with ‘uiautomator‘
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "ps ‘uiautomator‘"

info: [debug] No matching processes found

info: [debug] Running bootstrap
info: [debug] spawning: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap

info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1

info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1

info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724

info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] Waking up device if it‘s not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "dumpsys window"

info: [debug] Screen already unlocked, continuing.

info: [debug] Pushing command to appium work queue: ["getDataDir",{}]

info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp","status":0}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
info: [debug] Getting device API level
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "getprop ro.build.version.sdk"

info: [debug] Device is at API Level 17
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.dianping.v1/com.dianping.main.guide.SplashScreenActivity"

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}},"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}

info: <-- GET /wd/hub/status 200 3.736 ms - 155 {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}},"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}

info: [debug] Waiting for pkg "com.dianping.v1" and activity "com.dianping.main.guide.SplashScreenActivity" to be focused

info: [debug] Getting focused package and activity
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "dumpsys window windows"

info: [debug] Device launched! Ready for commands

info: [debug] Setting command timeout to the default of 7200 secs
info: [debug] Appium session started with sessionId b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5

info: <-- POST /wd/hub/session 303 8166.038 ms - 74
info: --> GET /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5 {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"deviceName":"351BBJNGTRWY","app":"/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk","autoLaunch":true,"platformVersion":"4.2","appPackage":"com.dianping.v1","platformName":"Android","appActivity":"com.dianping.main.guide.SplashScreenActivity"},"deviceName":"351BBJNGTRWY","app":"/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk","autoLaunch":true,"appPackage":"com.dianping.v1","platformName":"Android","appActivity":"com.dianping.main.guide.SplashScreenActivity"},"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}
info: <-- GET /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5 200 1.450 ms - 813 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"deviceName":"351BBJNGTRWY","app":"/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk","autoLaunch":true,"platformVersion":"4.2","appPackage":"com.dianping.v1","platformName":"Android","appActivity":"com.dianping.main.guide.SplashScreenActivity"},"deviceName":"351BBJNGTRWY","app":"/Users/ting/cop_files/evolution/appium/Nova_7.5.0_debug.apk","autoLaunch":true,"appPackage":"com.dianping.v1","platformName":"Android","appActivity":"com.dianping.main.guide.SplashScreenActivity"},"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}

info: --> POST /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5/element {"using":"xpath","sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5","value":"//android.widget.TextView[contains(@text,‘上海‘)]"}

info: [debug] Waiting up to 0ms for condition

info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.TextView[contains(@text,‘上海‘)]","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.TextView[contains(@text,‘上海‘)]","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.TextView[contains(@text,‘上海‘)] using XPATH with the contextId:  multiple: false

info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.TextView, INSTANCE=3]

info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"1"},"status":0}

info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}
info: <-- POST /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5/element 200 835.630 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}

info: --> POST /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5/element/1/click {"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5","id":"1"}
info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click

info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}

info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}
info: <-- POST /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5/element/1/click 200 394.520 ms - 76 {"status":0,"value":true,"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}

info: --> DELETE /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5 {}
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: /Users/ting/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 351BBJNGTRWY shell "input keyevent 3"

info: [debug] Stopping logcat capture

info: [debug] Logcat terminated with code null, signal SIGTERM

info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for UiAutomatorTestRunner=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 18.148
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1

info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}
info: <-- DELETE /wd/hub/session/b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5 200 768.028 ms - 76 {"status":0,"value":null,"sessionId":"b7c59dd7-66fe-4ab7-8c5f-5d0dc43c5ea5"}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}}}
info: <-- GET /wd/hub/status 200 0.707 ms - 104 {"status":0,"value":{"build":{"version":"1.3.7","revision":"72fbfaa116d3d9f6a862600ee99cf02f6d0e2182"}}}
时间: 2024-10-06 14:59:47

Appium自动化测试学习的相关文章

Appium自动化测试学习(二)

python中,在testcase中添加activity查询的时候 def test_CreateBookingOrder(self): #进入城市选择 activity=self.driver.current_activity #activity结果通过打印得到 print activity 始终提示错误 activity = self.driver.current_activity#activity结果通过打印得到AttributeError: 'WebDriver' object has

Appium自动化测试学习笔记 —— Appium原理

Appium简介 开源.跨平台.多语言支持的移动应用自动化工具 可测对象 原生应用APP.混合应用APP.移动Web App APP运行环境:真机.模拟器 测试对象App运行平台 IOS.Android(目前这两种是市场主流):Windows.FirefoxOS. 测试程序运行平台支持 Windows.Linux.Mac OS; 注:IOS应用appium server必须运行在Mac OS系统上,如 MacBook.imac: 支持的测试语言 python.Java.ruby.php.js.C

Appium自动化测试环境搭建

前言 Appium是一个开源的自动化测试框架,支持跨平台,支持多种编程语言,可用于原生,混合和移动web应用程序,使用webdriver驱动ios,android应用程序.那么为了学习app自动化测试首要任务肯定就是搭建测试开发环境, 因此在这里记一次搭建Appium自动化测试环境的完整过程,文章较长,需要花费一定的时间,请耐心阅读,如果文中有什么错误请指正 安装Java JDK JDK环境可以看我之前安装Jenkins时的随笔https://www.cnblogs.com/linuxchao/

android金阳光自动化测试——学习历程:电池续航上&amp;&amp;下

章节:自动化基础篇——电池续航自动化测试上&&下 网易云课堂: http://study.163.com/course/courseLearn.htm?courseId=712011#/learn/video?lessonId=878098&courseId=712011 http://study.163.com/course/courseLearn.htm?courseId=712011#/learn/video?lessonId=878099&courseId=7120

android金阳光自动化测试——学习历程:自动化预备知识上&amp;&amp;下

章节:自动化基础篇——自动化预备知识上&&下 网易云课堂: 上:http://study.163.com/course/courseLearn.htm?courseId=712011#/learn/video?lessonId=877113&courseId=712011 下:http://study.163.com/course/courseLearn.htm?courseId=712011#/learn/video?lessonId=877114&courseId=71

appium自动化测试(4)部分方法&unitest初步使用

捕捉弹窗 https://github.com/appium/appium/issues/968完整有截屏的例子:https://github.com/bitbar/testdroid-samples/blob/master/appium/sample-scripts/python/testdroid_android_hybrid.py有详细解释的例子:http://www.cnblogs.com/fnng/p/3300788.html 1.unittest 2.截屏并保存driver.save

appium自动化测试(3)-控件定位&中文输入

参考-控件定位 http://www.2cto.com/kf/201410/340345.html appium接口 http://appium.io/slate/en/master/?python#about-appium ◆ 控件定位就是精确的描述控件特征并告诉机器的过程.控件的特征就是控件的属性,可以通过上一讲中的uiautomatorviewer去获取.以下是方法: 1.通过resourceID获取 driver.find_element_by_id("com.android.conta

Appium自动化测试(1)-安装&环境

需要链接appium自动化测试教程 http://www.cnblogs.com/fnng/p/4540731.htmlappium中文文档:https://github.com/appium/appium/tree/master/docs/cn测试用例py在 F:\testSpace web自动化测试的路线是这样的:编程语言基础--->测试框架--->webdriver API--->开发自动化测试项目. 移动自动化的测试的路线要长一些:编程语言基础--->测试框架--->

QTP,自动化测试学习笔记,六月九号

测试自动化实现的两个难点 设计--功能分解 实现--对象的识别 测试自动化实现的两个难点-功能分解 清晰画出业务流程图 根据业务流程分解业务功能,可以被复用的功能也要被分解出来. 按照路径覆盖的思想,组织测试用例 测试自动化实现的两个难点-对象识别 创建测试    获取被操作对象的属性信息 使用唯一的对象名在对象仓库中记录该对象. 标识关键属性信息 在脚本中记录对象名称和相应的动作. 运行测试 从脚本中获得对象名称. 在对象仓库中定位对象,并获取其关键属性. 根据关键属性信息在被测应用中定位对象