• 😅 有强逼症蔓延,每次等电梯看着就不舒服

  • 我也遇到了这个问题,我目前解决了,我是在系统设置里把Jenkins URL 写成ip地址的就好了。如果使用localhost就会被禁止访问。

  • 作业一:

    设置了只要构建失败,就发送邮件。

    作业二:

    在配置的slave上去构建,并发送邮件。控制台输出如下:
    Started by user lily
    Building remotely on mac_nose (mac) in workspace /Users/abc/jenkins_nose/workspace/job2
    No emails were triggered.
    [job2] $ /bin/sh -xe /var/folders/z9/z978kmvj0nj252vkj9fzv2b40000gn/T/jenkins8778782371611761131.sh
    + pwd
    /Users/abc/jenkins_nose/workspace/job2
    + echo 'my job2 is:' testslave
    my job2 is: testslave
    Sending e-mails to: 811677334@qq.com
    Email was triggered for: Always
    Sending email for trigger: Always
    Sending email to: 811677334@qq.com
    Finished: SUCCESS
    
    

    作业三:使用jenkins+git+shell ,appium+Android真机
    遇到的问题:开始shell脚本写的不健壮,后续改了下启动就顺利了

    pwd
    appium &
    sleep 3s
    python3 test_kalaok_activity.py
    
    Started by user lily
    Building on master in workspace /Users/abc/.jenkins/jobs/job_appiumDemo/workspace
     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.origin.url https://github.com/Chaner2015/appium_testdemo.git # timeout=10
    Fetching upstream changes from https://github.com/Chaner2015/appium_testdemo.git
     > git --version # timeout=10
     > git fetch --tags --progress https://github.com/Chaner2015/appium_testdemo.git +refs/heads/*:refs/remotes/origin/*
     > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
     > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
    Checking out Revision 5f55e2c84605a3b2a434203a4996f464f5f22acb (refs/remotes/origin/master)
     > git config core.sparsecheckout # timeout=10
     > git checkout -f 5f55e2c84605a3b2a434203a4996f464f5f22acb
    Commit message: "提交测试脚本"
     > git rev-list --no-walk 5f55e2c84605a3b2a434203a4996f464f5f22acb # timeout=10
    [workspace] $ /bin/sh -xe /var/folders/z9/z978kmvj0nj252vkj9fzv2b40000gn/T/jenkins7083905736456201742.sh
    + pwd
    /Users/abc/.jenkins/jobs/job_appiumDemo/workspace
    + which python3
    /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
    + sleep 3s
    + appium
    [Appium] Welcome to Appium v1.7.2
    [Appium] Appium REST http interface listener started on 0.0.0.0:4723
    + python3 test_kalaok_activity.py
    [HTTP] --> POST /wd/hub/session {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"android"}},"desiredCapabilities":{"platformName":"android","deviceName":"vivoX5play","appPackage":"com.audiocn.kalaok","appActivity":"com.audiocn.common.activity.WelcomActivity","noReset":"true"}}
    [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformName":"android","deviceName":"vivoX5play","appPackage":"com.audiocn.kalaok","appActivity":"com.audiocn.common.activity.WelcomActivity","noReset":"true"},null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"android"}}]
    [debug] [BaseDriver] Event 'newSessionRequested' logged at 1522309491813 (15:44:51 GMT+0800 (CST))
    [Appium] Merged W3C capabilities {"firstMatch":[{}],"alwaysMatch":{"platformName... into desiredCapabilities object {"platformName":"android","deviceName":"vivoX5p...
    [Appium] Creating new AndroidDriver (v1.37.0) session
    [Appium] Capabilities:
    [Appium]   platformName: android
    [Appium]   deviceName: vivoX5play
    [Appium]   appPackage: com.audiocn.kalaok
    [Appium]   appActivity: com.audiocn.common.activity.WelcomActivity
    [Appium]   noReset: true
    [BaseDriver] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
    [BaseDriver] Session created with session id: 080a998e-118a-4dcb-8015-7eced650c190
    [debug] [AndroidDriver] Getting Java version
    [AndroidDriver] Java version is: 1.8.0_77
    [ADB] Checking whether adb is present
    [ADB] Using adb from /Users/abc/Library/Android/sdk/platform-tools/adb
    [AndroidDriver] Retrieving device list
    [debug] [ADB] Trying to find a connected android device
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [AndroidDriver] Using device: db58e7f7
    [ADB] Checking whether adb is present
    [debug] [ADB] Setting device id to db58e7f7
    [AndroidDriver] App file was not listed, instead we're going to run com.audiocn.kalaok directly on the device
    [debug] [AndroidDriver] Checking whether package is present on the device
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","pm","list","packages","com.audiocn.kalaok"]
    [AndroidDriver] Starting Android session
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","wait-for-device"]
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","echo","ping"]
    [AndroidDriver] setDeviceLanguageCountry requires language or country.
    [AndroidDriver] Got language: 'null' and country: 'null'
    [debug] [Logcat] Starting logcat capture
    [debug] [AndroidDriver] Pushing settings apk to device...
    [debug] [ADB] Getting install status for io.appium.settings
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","pm","list","packages","io.appium.settings"]
    [debug] [ADB] App is installed
    [debug] [ADB] Getting package info for io.appium.settings
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","dumpsys","package","io.appium.settings"]
    [ADB] Checking whether aapt is present
    [ADB] Using aapt from /Users/abc/Library/Android/sdk/build-tools/27.0.3/aapt
    [debug] [ADB] The installed 'io.appium.settings' package does not require upgrade (5 >= 5)
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","getprop","ro.build.version.sdk"]
    [debug] [ADB] Current device property 'ro.build.version.sdk': 22
    [debug] [ADB] Device API level: 22
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","dumpsys","package","io.appium.settings"]
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","ps"]
    [debug] [ADB] Device API level: 22
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","settings","put","secure","mock_location","1"]
    [debug] [AndroidDriver] Pushing unlock helper app to device...
    [debug] [ADB] Getting install status for io.appium.unlock
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","pm","list","packages","io.appium.unlock"]
    [debug] [ADB] App is installed
    [debug] [ADB] Getting package info for io.appium.unlock
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","dumpsys","package","io.appium.unlock"]
    [ADB] Checking whether aapt is present
    [debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade (2 >= 2)
    [ADB] Getting device platform version
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","getprop","ro.build.version.release"]
    [debug] [ADB] Current device property 'ro.build.version.release': 5.1.1
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","wm","size"]
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","getprop","ro.product.model"]
    [debug] [ADB] Current device property 'ro.product.model': vivo X7
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","getprop","ro.product.manufacturer"]
    [debug] [ADB] Current device property 'ro.product.manufacturer': vivo
    [AndroidDriver] No app sent in, not parsing package/activity
    [debug] [AndroidDriver] No app capability. Assuming it is already on the device
    [debug] [AndroidBootstrap] Watching for bootstrap disconnect
    [debug] [ADB] Forwarding system: 4724 to device: 4724
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","forward","tcp:4724","tcp:4724"]
    [debug] [UiAutomator] Starting UiAutomator
    [debug] [UiAutomator] Moving to state 'starting'
    [debug] [UiAutomator] Parsing uiautomator jar
    [debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar'
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","push","/usr/local/lib/node_modules/appium/node_modules/appium-android-bootstrap/bootstrap/bin/AppiumBootstrap.jar","/data/local/tmp/"]
    [debug] [ADB] Attempting to kill all uiautomator processes
    [debug] [ADB] Getting all processes with uiautomator
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","ps"]
    [ADB] No uiautomator process found to kill, continuing...
    [debug] [UiAutomator] Starting UIAutomator
    [debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","db58e7f7","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.audiocn.kalaok","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
    [debug] [UiAutomator] Moving to state 'online'
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json...
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
    [AndroidBootstrap] Android bootstrap socket is now connected
    [debug] [ADB] Getting connected devices...
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","dumpsys","window"]
    [AndroidDriver] Screen already unlocked, doing nothing
    [debug] [ADB] Device API level: 22
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","am","start","-W","-n","com.audiocn.kalaok/com.audiocn.common.activity.WelcomActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
    [Appium] New AndroidDriver session created successfully, session 080a998e-118a-4dcb-8015-7eced650c190 added to master session list
    [debug] [BaseDriver] Event 'newSessionStarted' logged at 1522309498587 (15:44:58 GMT+0800 (CST))
    [debug] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","deviceName":"vivoX5play","appPackage":"com.audiocn.kalaok","appActivity":"com.audiocn.common.activity.WelcomActivity","noReset":true},"platformName":"android","deviceName":"db58e7f7","appPackage":"com.audiocn.kalaok","appActivity":"com.audiocn.common.activity.WelcomActivity","noReset":true,"deviceUDID":"db58e7f7","platformVersion":"5.1.1","deviceScreenSize":"1080x1920","deviceModel":"vivo X7","deviceManufacturer":"vivo"}
    [HTTP] <-- POST /wd/hub/session 200 6782 ms - 728 
    [HTTP] --> POST /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/element {"using":"xpath","value":"//*[@text='活动']","sessionId":"080a998e-118a-4dcb-8015-7eced650c190"}
    [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[@text='活动']","080a998e-118a-4dcb-8015-7eced650c190"]
    [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
    [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
    [debug] [BaseDriver] Waiting up to 0 ms for condition
    [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[@text='活动']","context":"","multiple":false}}
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[@text='活动']","context":"","multiple":false}}
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[@text='活动']' using 'XPATH' with the contextId: '' multiple: false
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.TextView, INSTANCE=2]
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
    [debug] [AndroidBootstrap] Received command result from bootstrap
    [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"1"}
    [HTTP] <-- POST /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/element 200 202 ms - 87 
    [HTTP] --> POST /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/element/1/click {"id":"1","sessionId":"080a998e-118a-4dcb-8015-7eced650c190"}
    [debug] [MJSONWP] Calling AppiumDriver.click() with args: ["1","080a998e-118a-4dcb-8015-7eced650c190"]
    [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
    [debug] [AndroidBootstrap] Received command result from bootstrap
    [debug] [MJSONWP] Responding to client with driver.click() result: true
    [HTTP] <-- POST /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/element/1/click 200 645 ms - 76 
    [HTTP] --> GET /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/contexts {}
    [debug] [MJSONWP] Calling AppiumDriver.getContexts() with args: ["080a998e-118a-4dcb-8015-7eced650c190"]
    [debug] [AndroidDriver] Getting a list of available webviews
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running '/Users/abc/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","db58e7f7","shell","cat","/proc/net/unix"]
    [debug] [AndroidDriver] Found webviews: []
    [debug] [AndroidDriver] Available contexts: ["NATIVE_APP"]
    [debug] [MJSONWP] Responding to client with driver.getContexts() result: ["NATIVE_APP"]
    [HTTP] <-- GET /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/contexts 200 55 ms - 86 
    [HTTP] --> POST /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/back {"sessionId":"080a998e-118a-4dcb-8015-7eced650c190"}
    [debug] [MJSONWP] Calling AppiumDriver.back() with args: ["080a998e-118a-4dcb-8015-7eced650c190"]
    [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"pressBack","params":{}}
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"pressBack","params":{}}
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: pressBack
    [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
    [debug] [AndroidBootstrap] Received command result from bootstrap
    [debug] [MJSONWP] Responding to client with driver.back() result: true
    [HTTP] <-- POST /wd/hub/session/080a998e-118a-4dcb-8015-7eced650c190/back 200 802 ms - 76 
    .
    ----------------------------------------------------------------------
    Ran 1 test in 18.574s
    
    OK
    contexts: ['NATIVE_APP']
    测试结束,清理环境ing
    Process leaked file descriptors. See https://jenkins.io/redirect/troubleshooting/process-leaked-file-descriptors for more information
    [Appium] Received SIGTERM - shutting down
    Sending e-mails to: 811677334@qq.com 554784810@qq.com
    Finished: SUCCESS
    
    
  • 没有找到哪里可以配置每个操作的延时设置,像monkey的 --throttle<毫秒>参数一样,有对应参数支持吗?是不是如果加了延时操作的快的话会导致很多页面找不到元素了。

  • 仅楼主可见
  • [XCUITest] Current user: 'abc'
    [XCUITest] Current version of libimobiledevice: stable 1.2.0 (bottled), HEAD
    [XCUITest] Error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.
    at getVersionWithoutRetry$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcode/lib/xcode.js:116:11)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke as _invoke
    at GeneratorFunctionPrototype.prototype.(anonymous function) as next
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at

  • 浅学 Python 的 with 语句 at 2018年01月29日

    刚学习了with用法,讲的很细,赞👍!

  • “投入技术成本--减少整体成本--空余出的成本投入其他技术项目--减少更多的成本--有更多的空余成本投入其他能提高产品质量的技术项目上--产品质量越来越好,良性循环。”----超赞同

  • 天蝎boy比较适合双鱼女😺