[Appium]Re-use existing WDA in create session command

In [Appium] Prevent building WDA with useXctestrunFile or usePrebuiltWDA, I explained how to skip re-building WDA every session in order to make test setup faster.

I would like to show a “cache” feature for WDA in Appium. After this PR , the function will work correctly. The PR will be in 1.12.1 or 1.13.0.

As a user, avoiding useNewWDA: true is the only thing to get the benefit since the capability forces Appium to re-install WDA every session.

Below comparison data is based on ruby_lib_core test suite. The host machine spec is also the same as [Appium] Prevent building WDA with useXctestrunFile or usePrebuiltWDA.

Result

  • After: Upcoming Appium
    • 4 sec
  • Before: Appium 1.12.0
    • 20 sec

The range to measure the time was in a create session command. As a Appium log, from --> POST /wd/hub/session to [HTTP] <-- POST /wd/hub/session/xxxxx/timeouts 200 8 ms - 14 was.

You can run UI tests less delay between each test case. If you do not change or re-install WDA every session, the improvement has a significant impact on your test running time.

Logs

The fidderence between the before and after is [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}. It appears frequently in the Before log, while non of such loop in the After log.

A log in Before

2019-03-23 10:02:00:880 - [HTTP] --> POST /wd/hub/session
2019-03-23 10:02:00:880 - [HTTP] {"desiredCapabilities":{"platformName":"ios","automationName":"XCUITest","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","udid":"auto","platformVersion":"12.1","deviceName":"iPhone 8","useNewWDA":false,"useJSONSource":true,"someCapability":"some_capability","newCommandTimeout":120,"wdaLocalPort":8100,"waitForQuiescence":true,"reduceMotion":true,"screenshotQuality":2,"xcodeSigningId":"iPhone Developer","xcodeOrgId":"xxxxxx","updatedWDABundleId":"com.kazucocoa.WebDriverAgentRunner","derivedDataPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx","bootstrapPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products","useXctestrunFile":true},"capabilities":{"firstMatch":[{"platformName":"ios","appium:automationName":"XCUITest","appium:bundleId":"com.kazucocoa.apple-samplecode.UICatalog","appium:udid":"auto","appium:platformVersion":"12.1","appium:deviceName":"iPhone 8","appium:useNewWDA":false,"appium:useJSONSource":true,"appium:someCapability":"some_capability","appium:ne
2019-03-23 10:02:00:882 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"ios","automationName":"XCUITest","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","udid":"auto","platformVersion":"12.1","deviceName":"iPhone 8","useNewWDA":false,"useJSONSource":true,"someCapability":"some_capability","newCommandTimeout":120,"wdaLocalPort":8100,"waitForQuiescence":true,"reduceMotion":true,"screenshotQuality":2,"xcodeSigningId":"iPhone Developer","xcodeOrgId":"xxxxxx","updatedWDABundleId":"com.kazucocoa.WebDriverAgentRunner","derivedDataPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx","bootstrapPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products","useXctestrunFile":true},null,{"firstMatch":[{"platformName":"ios","appium:automationName":"XCUITest","appium:bundleId":"com.kazucocoa.apple-samplecode.UICatalog","appium:udid":"auto","appium:platformVersion":"12.1","appium:deviceName":"iPhone 8","appium:useNewWDA":false,"appium:useJSONSource":true,"appium:someCapability":"some_capability","appium:newCommandTimeout":120,"appium:wdaLocalPort":8100,"appi...
2019-03-23 10:02:00:883 - [debug] [BaseDriver] Event 'newSessionRequested' logged at 1553335320883 (19:02:00 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:01:068 - [Appium] Appium v1.12.0-beta.0 creating new XCUITestDriver (v2.109.0) session
2019-03-23 10:02:01:069 - [Appium] Capabilities:
2019-03-23 10:02:01:069 - [Appium]   platformName: ios
2019-03-23 10:02:01:069 - [Appium]   automationName: XCUITest
2019-03-23 10:02:01:069 - [Appium]   bundleId: com.kazucocoa.apple-samplecode.UICatalog
2019-03-23 10:02:01:069 - [Appium]   udid: auto
2019-03-23 10:02:01:069 - [Appium]   platformVersion: 12.1
2019-03-23 10:02:01:069 - [Appium]   deviceName: iPhone 8
2019-03-23 10:02:01:069 - [Appium]   useNewWDA: false
2019-03-23 10:02:01:069 - [Appium]   useJSONSource: true
...
2019-03-23 10:02:01:070 - [Appium]   updatedWDABundleId: com.kazucocoa.WebDriverAgentRunner
2019-03-23 10:02:01:070 - [Appium]   derivedDataPath: /Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx
2019-03-23 10:02:01:070 - [Appium]   bootstrapPath: /Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products
2019-03-23 10:02:01:070 - [Appium]   useXctestrunFile: true
2019-03-23 10:02:01:072 - [debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"platformName":"ios","auto... were provided
2019-03-23 10:02:01:072 - [debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
2019-03-23 10:02:01:077 - [BaseDriver] The following capabilities were provided, but are not recognized by appium: someCapability.
2019-03-23 10:02:01:078 - [BaseDriver] Session created with session id: afbfeff7-3d9d-4857-9724-8a32e650fde6
...
2019-03-23 10:02:01:495 - [XCUITest] Setting up real device
2019-03-23 10:02:01:899 - [XCUITest] Using WDA path: '/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products'
2019-03-23 10:02:01:899 - [XCUITest] Using WDA agent: '/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products/WebDriverAgent.xcodeproj'
2019-03-23 10:02:02:074 - [XCUITest] Detected 1 obsolete cached process from previous WDA sessions. Cleaning up...
2019-03-23 10:02:02:086 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:02:087 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:05:106 - [WD Proxy] Got an unexpected response: {"code":"ESOCKETTIMEDOUT","connect":false}
2019-03-23 10:02:05:107 - [debug] [XCUITest] WDA is not listening at 'http://localhost:8100/'
2019-03-23 10:02:05:107 - [debug] [XCUITest] WDA is currently not running. There is nothing to cache
2019-03-23 10:02:05:107 - [debug] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
2019-03-23 10:02:05:107 - [debug] [XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
2019-03-23 10:02:05:108 - [debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1553335325108 (19:02:05 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:05:108 - [XCUITest] Launching WebDriverAgent on the device
2019-03-23 10:02:05:109 - [debug] [XCUITest] Killing running processes 'xcodebuild.*242bfcc998fd156df0bd0ad1dde8ab8e0a032114, iproxy 8100' for the device 242bfcc998fd156df0bd0ad1dde8ab8e0a032114...
2019-03-23 10:02:05:324 - [debug] [XCUITest] 'pgrep -nif xcodebuild.*242bfcc998fd156df0bd0ad1dde8ab8e0a032114' didn't detect any matching processes. Return code: 1
2019-03-23 10:02:05:356 - [debug] [XCUITest] 'pgrep -nif iproxy 8100' didn't detect any matching processes. Return code: 1
2019-03-23 10:02:05:356 - [debug] [XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB for the device 242bfcc998fd156df0bd0ad1dde8ab8e0a032114
2019-03-23 10:02:10:383 - [debug] [XCUITest] Beginning test with command 'xcodebuild test-without-building -xctestrun /Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products/242bfcc998fd156df0bd0ad1dde8ab8e0a032114_12.1.xctestrun -destination id=242bfcc998fd156df0bd0ad1dde8ab8e0a032114 IPHONEOS_DEPLOYMENT_TARGET=12.1 GCC_TREAT_WARNINGS_AS_ERRORS=0' in directory '/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products'
2019-03-23 10:02:10:384 - [debug] [XCUITest] Output from xcodebuild will not be logged. To change this, use 'showXcodeLog' desired capability
2019-03-23 10:02:10:979 - [debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
2019-03-23 10:02:10:980 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:10:981 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:10:990 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:11:652 - [debug] [XCUITest] Log file for xcodebuild test: /Users/kazu/Library/Developer/Xcode/DerivedData/temporary-fkyiqlfygocksigngthmuhoipeic/Logs/Test/Test-Transient Testing-2019.03.23_19-02-11-+0900.xcresult/1_Test/Diagnostics/WebDriverAgentRunner-0B9129D8-85D9-476A-84AD-75E64C230A99/WebDriverAgentRunner-EEA39F35-7427-4D00-B4F4-522C3A215EA0/Session-WebDriverAgentRunner-2019-03-23_190211-B6ptNa.log
2019-03-23 10:02:11:991 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:11:992 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:11:996 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:12:997 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:12:997 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:13:005 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:14:006 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:14:006 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:14:011 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:15:011 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:15:011 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:15:016 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:16:017 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:16:017 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:16:024 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:17:024 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:17:025 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:17:030 - [WD Proxy] Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
2019-03-23 10:02:18:031 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:18:032 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:18:051 - [debug] [WD Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"state\" : \"success\",\n    \"os\" : {\n      \"name\" : \"iOS\",\n      \"version\" : \"12.1.4\",\n      \"sdkVersion\" : \"12.0\"\n    },\n    \"ios\" : {\n      \"simulatorVersion\" : \"12.1.4\",\n      \"ip\" : \"172.254.99.33\"\n    },\n    \"build\" : {\n      \"upgradedAt\" : \"1552566621411\",\n      \"time\" : \"Mar 23 2019 13:54:25\",\n      \"productBundleIdentifier\" : \"com.kazucocoa.WebDriverAgentRunner\"\n    }\n  },\n  \"sessionId\" : \"F928A843-EFDA-4BCA-B1FA-EA770C936B7F\",\n  \"status\" : 0\n}"
2019-03-23 10:02:18:052 - [debug] [XCUITest] WebDriverAgent information:
2019-03-23 10:02:18:052 - [debug] [XCUITest] {
2019-03-23 10:02:18:052 - [debug] [XCUITest]   "state": "success",
2019-03-23 10:02:18:052 - [debug] [XCUITest]   "os": {
2019-03-23 10:02:18:052 - [debug] [XCUITest]     "name": "iOS",
2019-03-23 10:02:18:052 - [debug] [XCUITest]     "version": "12.1.4",
2019-03-23 10:02:18:052 - [debug] [XCUITest]     "sdkVersion": "12.0"
2019-03-23 10:02:18:052 - [debug] [XCUITest]   },
2019-03-23 10:02:18:052 - [debug] [XCUITest]   "ios": {
2019-03-23 10:02:18:052 - [debug] [XCUITest]     "simulatorVersion": "12.1.4",
2019-03-23 10:02:18:053 - [debug] [XCUITest]     "ip": "172.254.99.33"
2019-03-23 10:02:18:053 - [debug] [XCUITest]   },
2019-03-23 10:02:18:053 - [debug] [XCUITest]   "build": {
2019-03-23 10:02:18:053 - [debug] [XCUITest]     "upgradedAt": "1552566621411",
2019-03-23 10:02:18:053 - [debug] [XCUITest]     "time": "Mar 23 2019 13:54:25",
2019-03-23 10:02:18:053 - [debug] [XCUITest]     "productBundleIdentifier": "com.kazucocoa.WebDriverAgentRunner"
2019-03-23 10:02:18:053 - [debug] [XCUITest]   }
2019-03-23 10:02:18:053 - [debug] [XCUITest] }
2019-03-23 10:02:18:054 - [debug] [XCUITest] WebDriverAgent successfully started after 7669ms
2019-03-23 10:02:18:055 - [debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1553335338055 (19:02:18 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:18:055 - [debug] [XCUITest] Sending createSession command to WDA
2019-03-23 10:02:18:056 - [debug] [WD Proxy] Matched '/session' to command name 'createSession'
2019-03-23 10:02:18:056 - [debug] [WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.kazucocoa.apple-samplecode.UICatalog","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
2019-03-23 10:02:20:733 - [debug] [WD Proxy] Got response with status 200: {"value":{"sessionId":"20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3","capabilities":{"device":"iphone","browserName":"UICatalog","sdkVersion":"12.1.4","CFBundleIdentifier":"com.kazucocoa.apple-samplecode.UICatalog"}},"sessionId":"20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3","status":0}
2019-03-23 10:02:20:733 - [debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1553335340733 (19:02:20 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:20:733 - [debug] [BaseDriver] Event 'wdaStarted' logged at 1553335340733 (19:02:20 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:20:733 - [XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
2019-03-23 10:02:20:733 - [debug] [BaseDriver] Event 'orientationSet' logged at 1553335340733 (19:02:20 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:20:741 - [debug] [WD Proxy] Matched '/appium/settings' to command name 'updateSettings'
2019-03-23 10:02:20:741 - [debug] [WD Proxy] Proxying [POST /appium/settings] to [POST http://localhost:8100/session/20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3/appium/settings] with body: {"settings":{"useJSONSource":true}}
2019-03-23 10:02:20:747 - [debug] [WD Proxy] Got response with status 200: {"value":{"screenshotQuality":1,"mjpegScalingFactor":100,"elementResponseAttributes":"type,label","shouldUseCompactResponses":true,"mjpegServerFramerate":10,"mjpegServerScreenshotQuality":25},"sessionId":"20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3","status":0}
2019-03-23 10:02:20:747 - [XCUITest] Setting the quality of phone screenshot: '2'
2019-03-23 10:02:20:748 - [debug] [WD Proxy] Matched '/appium/settings' to command name 'updateSettings'
2019-03-23 10:02:20:749 - [debug] [WD Proxy] Proxying [POST /appium/settings] to [POST http://localhost:8100/session/20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3/appium/settings] with body: {"settings":{"screenshotQuality":2}}
2019-03-23 10:02:20:749 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:20:749 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:20:753 - [debug] [WD Proxy] Got response with status 200: {"value":{"screenshotQuality":2,"mjpegScalingFactor":100,"elementResponseAttributes":"type,label","shouldUseCompactResponses":true,"mjpegServerFramerate":10,"mjpegServerScreenshotQuality":25},"sessionId":"20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3","status":0}
2019-03-23 10:02:20:754 - [Appium] New XCUITestDriver session created successfully, session afbfeff7-3d9d-4857-9724-8a32e650fde6 added to master session list
2019-03-23 10:02:20:754 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1553335340754 (19:02:20 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:20:755 - [debug] [W3C (afbfeff7)] Cached the protocol value 'W3C' for the new session afbfeff7-3d9d-4857-9724-8a32e650fde6
2019-03-23 10:02:20:755 - [debug] [W3C (afbfeff7)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","automationName":"XCUITest","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","udid":"242bfcc998fd156df0bd0ad1dde8ab8e0a032114","platformVersion":"12.1","deviceName":"iPhone 8","useNewWDA":false,"useJSONSource":true,"someCapability":"some_capability","newCommandTimeout":120,"wdaLocalPort":8100,"waitForQuiescence":true,"reduceMotion":true,"screenshotQuality":2,"xcodeSigningId":"iPhone Developer","xcodeOrgId":"xxxxxx","updatedWDABundleId":"com.kazucocoa.WebDriverAgentRunner","derivedDataPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx","bootstrapPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products","useXctestrunFile":true}}
2019-03-23 10:02:20:759 - [HTTP] <-- POST /wd/hub/session 200 19878 ms - 951
2019-03-23 10:02:20:759 - [HTTP]
2019-03-23 10:02:20:759 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:20:759 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:20:761 - [HTTP] --> POST /wd/hub/session/afbfeff7-3d9d-4857-9724-8a32e650fde6/timeouts
2019-03-23 10:02:20:761 - [HTTP] {"implicit":0}
2019-03-23 10:02:20:762 - [debug] [W3C (afbfeff7)] Calling AppiumDriver.timeouts() with args: [null,null,null,null,0,"afbfeff7-3d9d-4857-9724-8a32e650fde6"]
2019-03-23 10:02:20:762 - [debug] [XCUITest] Executing command 'timeouts'
2019-03-23 10:02:20:768 - [debug] [BaseDriver] W3C timeout argument: {"implicit":0}}
2019-03-23 10:02:20:768 - [debug] [BaseDriver] Set implicit wait to 0ms
2019-03-23 10:02:20:768 - [debug] [W3C (afbfeff7)] Responding to client with driver.timeouts() result: null
2019-03-23 10:02:20:769 - [HTTP] <-- POST /wd/hub/session/afbfeff7-3d9d-4857-9724-8a32e650fde6/timeouts 200 8 ms - 14
2019-03-23 10:02:20:769 - [HTTP]

A log in After

2019-03-23 10:02:51:982 - [HTTP] --> POST /wd/hub/session
2019-03-23 10:02:51:982 - [HTTP] {"desiredCapabilities":{"platformName":"ios","automationName":"XCUITest","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","udid":"auto","platformVersion":"12.1","deviceName":"iPhone 8","useNewWDA":false,"useJSONSource":true,"someCapability":"some_capability","newCommandTimeout":120,"wdaLocalPort":8100,"waitForQuiescence":true,"reduceMotion":true,"screenshotQuality":2,"xcodeSigningId":"iPhone Developer","xcodeOrgId":"xxxxxx","updatedWDABundleId":"com.kazucocoa.WebDriverAgentRunner","derivedDataPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx","bootstrapPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products","useXctestrunFile":true},"capabilities":{"firstMatch":[{"platformName":"ios","appium:automationName":"XCUITest","appium:bundleId":"com.kazucocoa.apple-samplecode.UICatalog","appium:udid":"auto","appium:platformVersion":"12.1","appium:deviceName":"iPhone 8","appium:useNewWDA":false,"appium:useJSONSource":true,"appium:someCapability":"some_capability","appium:ne
2019-03-23 10:02:51:983 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"ios","automationName":"XCUITest","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","udid":"auto","platformVersion":"12.1","deviceName":"iPhone 8","useNewWDA":false,"useJSONSource":true,"someCapability":"some_capability","newCommandTimeout":120,"wdaLocalPort":8100,"waitForQuiescence":true,"reduceMotion":true,"screenshotQuality":2,"xcodeSigningId":"iPhone Developer","xcodeOrgId":"xxxxxx","updatedWDABundleId":"com.kazucocoa.WebDriverAgentRunner","derivedDataPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx","bootstrapPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products","useXctestrunFile":true},null,{"firstMatch":[{"platformName":"ios","appium:automationName":"XCUITest","appium:bundleId":"com.kazucocoa.apple-samplecode.UICatalog","appium:udid":"auto","appium:platformVersion":"12.1","appium:deviceName":"iPhone 8","appium:useNewWDA":false,"appium:useJSONSource":true,"appium:someCapability":"some_capability","appium:newCommandTimeout":120,"appium:wdaLocalPort":8100,"appi...
2019-03-23 10:02:51:983 - [debug] [BaseDriver] Event 'newSessionRequested' logged at 1553335371983 (19:02:51 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:51:984 - [Appium] Appium v1.12.0-beta.0 creating new XCUITestDriver (v2.109.0) session
2019-03-23 10:02:51:985 - [Appium] Capabilities:
2019-03-23 10:02:51:985 - [Appium]   platformName: ios
2019-03-23 10:02:51:985 - [Appium]   automationName: XCUITest
2019-03-23 10:02:51:985 - [Appium]   bundleId: com.kazucocoa.apple-samplecode.UICatalog
2019-03-23 10:02:51:986 - [Appium]   udid: auto
2019-03-23 10:02:51:986 - [Appium]   platformVersion: 12.1
2019-03-23 10:02:51:986 - [Appium]   deviceName: iPhone 8
2019-03-23 10:02:51:986 - [Appium]   useNewWDA: false
2019-03-23 10:02:51:986 - [Appium]   useJSONSource: true
...
2019-03-23 10:02:51:987 - [Appium]   updatedWDABundleId: com.kazucocoa.WebDriverAgentRunner
2019-03-23 10:02:51:987 - [Appium]   derivedDataPath: /Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx
2019-03-23 10:02:51:987 - [Appium]   bootstrapPath: /Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products
2019-03-23 10:02:51:987 - [Appium]   useXctestrunFile: true
2019-03-23 10:02:51:988 - [debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"platformName":"ios","auto... were provided
2019-03-23 10:02:51:988 - [debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
2019-03-23 10:02:51:992 - [BaseDriver] The following capabilities were provided, but are not recognized by appium: someCapability.
2019-03-23 10:02:51:993 - [BaseDriver] Session created with session id: b7c1b068-2b1f-420f-ae2a-4b7de624bb77
...
2019-03-23 10:02:52:224 - [XCUITest] Setting up real device
2019-03-23 10:02:52:623 - [XCUITest] Using WDA path: '/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products'
2019-03-23 10:02:52:623 - [XCUITest] Using WDA agent: '/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products/WebDriverAgent.xcodeproj'
2019-03-23 10:02:52:771 - [XCUITest] Detected 1 obsolete cached process from previous WDA sessions. Cleaning up...
2019-03-23 10:02:52:777 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:52:777 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:52:787 - [debug] [WD Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"state\" : \"success\",\n    \"os\" : {\n      \"name\" : \"iOS\",\n      \"version\" : \"12.1.4\",\n      \"sdkVersion\" : \"12.0\"\n    },\n    \"ios\" : {\n      \"simulatorVersion\" : \"12.1.4\",\n      \"ip\" : \"172.254.99.33\"\n    },\n    \"build\" : {\n      \"upgradedAt\" : \"1552566621411\",\n      \"time\" : \"Mar 23 2019 13:54:25\",\n      \"productBundleIdentifier\" : \"com.kazucocoa.WebDriverAgentRunner\"\n    }\n  },\n  \"sessionId\" : \"20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3\",\n  \"status\" : 0\n}"
2019-03-23 10:02:52:787 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:52:787 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:52:788 - [debug] [XCUITest] Upgrade timestamp of the currently bundled WDA: null
2019-03-23 10:02:52:788 - [debug] [XCUITest] Upgrade timestamp of the WDA on the device: 1552566621411
2019-03-23 10:02:52:788 - [XCUITest] Will reuse previously cached WDA instance at 'http://localhost:8100/' with 'com.kazucocoa.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
2019-03-23 10:02:52:788 - [debug] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
2019-03-23 10:02:52:788 - [debug] [XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
2019-03-23 10:02:52:788 - [debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1553335372788 (19:02:52 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:52:788 - [XCUITest] Using provided WebdriverAgent at 'http://localhost:8100/'
2019-03-23 10:02:52:789 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2019-03-23 10:02:52:803 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-03-23 10:02:52:810 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:52:810 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:52:811 - [debug] [WD Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"state\" : \"success\",\n    \"os\" : {\n      \"name\" : \"iOS\",\n      \"version\" : \"12.1.4\",\n      \"sdkVersion\" : \"12.0\"\n    },\n    \"ios\" : {\n      \"simulatorVersion\" : \"12.1.4\",\n      \"ip\" : \"172.254.99.33\"\n    },\n    \"build\" : {\n      \"upgradedAt\" : \"1552566621411\",\n      \"time\" : \"Mar 23 2019 13:54:25\",\n      \"productBundleIdentifier\" : \"com.kazucocoa.WebDriverAgentRunner\"\n    }\n  },\n  \"sessionId\" : \"20DCD0BD-8DF0-403B-B1E7-054C5AAEBFF3\",\n  \"status\" : 0\n}"
2019-03-23 10:02:52:811 - [debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1553335372811 (19:02:52 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:52:811 - [debug] [XCUITest] Sending createSession command to WDA
2019-03-23 10:02:52:811 - [debug] [WD Proxy] Matched '/session' to command name 'createSession'
2019-03-23 10:02:52:811 - [debug] [WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.kazucocoa.apple-samplecode.UICatalog","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
2019-03-23 10:02:55:881 - [debug] [WD Proxy] Got response with status 200: {"value":{"sessionId":"AF83370F-5CF2-458D-9945-2050BD7E38AF","capabilities":{"device":"iphone","browserName":"UICatalog","sdkVersion":"12.1.4","CFBundleIdentifier":"com.kazucocoa.apple-samplecode.UICatalog"}},"sessionId":"AF83370F-5CF2-458D-9945-2050BD7E38AF","status":0}
2019-03-23 10:02:55:881 - [debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1553335375881 (19:02:55 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:55:882 - [debug] [BaseDriver] Event 'wdaStarted' logged at 1553335375881 (19:02:55 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:55:882 - [XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
2019-03-23 10:02:55:882 - [debug] [BaseDriver] Event 'orientationSet' logged at 1553335375882 (19:02:55 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:55:885 - [debug] [WD Proxy] Matched '/appium/settings' to command name 'updateSettings'
2019-03-23 10:02:55:885 - [debug] [WD Proxy] Proxying [POST /appium/settings] to [POST http://localhost:8100/session/AF83370F-5CF2-458D-9945-2050BD7E38AF/appium/settings] with body: {"settings":{"useJSONSource":true}}
2019-03-23 10:02:55:885 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:55:886 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:55:891 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:55:891 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:55:891 - [debug] [WD Proxy] Got response with status 200: {"value":{"screenshotQuality":2,"mjpegScalingFactor":100,"elementResponseAttributes":"type,label","shouldUseCompactResponses":true,"mjpegServerFramerate":10,"mjpegServerScreenshotQuality":25},"sessionId":"AF83370F-5CF2-458D-9945-2050BD7E38AF","status":0}
2019-03-23 10:02:55:891 - [XCUITest] Setting the quality of phone screenshot: '2'
2019-03-23 10:02:55:893 - [debug] [WD Proxy] Matched '/appium/settings' to command name 'updateSettings'
2019-03-23 10:02:55:893 - [debug] [WD Proxy] Proxying [POST /appium/settings] to [POST http://localhost:8100/session/AF83370F-5CF2-458D-9945-2050BD7E38AF/appium/settings] with body: {"settings":{"screenshotQuality":2}}
2019-03-23 10:02:55:898 - [debug] [XCUITest] Connection to WDA timed out
2019-03-23 10:02:55:898 - [debug] [iProxy] recv failed: Operation not permitted
2019-03-23 10:02:55:900 - [debug] [WD Proxy] Got response with status 200: {"value":{"screenshotQuality":2,"mjpegScalingFactor":100,"elementResponseAttributes":"type,label","shouldUseCompactResponses":true,"mjpegServerFramerate":10,"mjpegServerScreenshotQuality":25},"sessionId":"AF83370F-5CF2-458D-9945-2050BD7E38AF","status":0}
2019-03-23 10:02:55:900 - [Appium] New XCUITestDriver session created successfully, session b7c1b068-2b1f-420f-ae2a-4b7de624bb77 added to master session list
2019-03-23 10:02:55:900 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1553335375900 (19:02:55 GMT+0900 (Japan Standard Time))
2019-03-23 10:02:55:900 - [debug] [W3C (b7c1b068)] Cached the protocol value 'W3C' for the new session b7c1b068-2b1f-420f-ae2a-4b7de624bb77
2019-03-23 10:02:55:901 - [debug] [W3C (b7c1b068)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","automationName":"XCUITest","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","udid":"242bfcc998fd156df0bd0ad1dde8ab8e0a032114","platformVersion":"12.1","deviceName":"iPhone 8","useNewWDA":false,"useJSONSource":true,"someCapability":"some_capability","newCommandTimeout":120,"wdaLocalPort":8100,"waitForQuiescence":true,"reduceMotion":true,"screenshotQuality":2,"xcodeSigningId":"iPhone Developer","xcodeOrgId":"xxxxxx","updatedWDABundleId":"com.kazucocoa.WebDriverAgentRunner","derivedDataPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx","bootstrapPath":"/Users/kazu/GitHub/ruby_lib_core/tmp/xxxxxx/Build/Products","useXctestrunFile":true}}
2019-03-23 10:02:55:902 - [HTTP] <-- POST /wd/hub/session 200 3919 ms - 951
2019-03-23 10:02:55:908 - [HTTP]
2019-03-23 10:02:55:909 - [HTTP] --> POST /wd/hub/session/b7c1b068-2b1f-420f-ae2a-4b7de624bb77/timeouts
2019-03-23 10:02:55:909 - [HTTP] {"implicit":0}
2019-03-23 10:02:55:909 - [debug] [W3C (b7c1b068)] Calling AppiumDriver.timeouts() with args: [null,null,null,null,0,"b7c1b068-2b1f-420f-ae2a-4b7de624bb77"]
2019-03-23 10:02:55:910 - [debug] [XCUITest] Executing command 'timeouts'
2019-03-23 10:02:55:911 - [debug] [BaseDriver] W3C timeout argument: {"implicit":0}}
2019-03-23 10:02:55:911 - [debug] [BaseDriver] Set implicit wait to 0ms
2019-03-23 10:02:55:911 - [debug] [W3C (b7c1b068)] Responding to client with driver.timeouts() result: null
2019-03-23 10:02:55:912 - [HTTP] <-- POST /wd/hub/session/b7c1b068-2b1f-420f-ae2a-4b7de624bb77/timeouts 200 2 ms - 14
2019-03-23 10:02:55:912 - [HTTP]

Conclusion

The time has been improved.

Automated tests are not only “conducting tests” part, but also designing and analysing the result. We have many tools to achieve it. Re-using other area’s brilliant knowledge is also important.

I hope Appium can be a way to achieve it across various platforms. Not only for iOS and Swift, Android for Java/Kotlin, Windows for .NET, etc.

1 Comment

  1. Long Nguyen's avatar Long Nguyen says:

    Thanks you. This is what I need to reduce loading time

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.