Automation testing practices:
Kobiton applies the following timeouts in an Automation session:
- On the first request to initialize a session (e.g. "POST /wd/hub/session"), Kobiton will terminate the session if there is no response to the test script after a timeout.
- If the test session is web testing (i.e. use browser in desired Capabilities), the timeout is 10 minutes.
- If the test session is app testing (i.e. use app in desired Capabilities), the timeout is 30 minutes.
- On subsequent requests, Kobiton will terminate the session if there is no response to the test script after 10 minutes.
Kobiton also supports user-specified Appium implicit / explicit wait timeouts in automation scripts. Testers are able to use Appium / Selenium commands to specify (implicit / explicit) wait timeout duration during a running Automation session. When a wait timeout is provided in test script, Kobiton ensures that it matches with a Kobiton-specific value range.
- The minimum wait timeout is 10 seconds, if given value is lower, Kobiton will use 10 seconds
- The maximum wait timeout is 30 minutes, if given value is higher, Kobiton will use 30 minutes
To have more info about wait timeout, consult Selenium document
Override HTTP timeout for client libraries
The HTTP library used by various client libraries usually has a timeout of 2 minutes. That is, when the HTTP library is used to send an HTTP request, it will wait for the response in a certain timeout before terminating the request. However, an app _test session (i.e. use _app in desired Capabilities) may need more than 2 minutes to initialize because it needs to download and install the app. Therefore, to prevent the client libraries from ending prematurely, users should extend the timeout, which should not exceed 30 minutes (the max timeout used by Kobiton). Please see Set custom timeout on testing client libraries for examples of changing timeout.
Set custom timeout on testing client libraries:
This document explains how to set an HTTP timeout in popular client libraries.
Currently Appium has an issue about this, so this code would throw error. This sample code should work after the issue was resolved. Github issue link here.
int connectionTimeout = 20 * 60 * 1000; int socketTimeout= 90 * 1000;
ApacheHttpClient.Factory clientFactory = new ApacheHttpClient.Factory(new HttpClientFactory(connectionTimeout, socketTimeout)); AppiumCommandExecutor executor = new AppiumCommandExecutor(new HashMap<String, AppiumCommandInfo>(), new URL(kobitonServerUrl),clientFactory); AndroidDriver driver = new AndroidDriver<>(executor, capabilities);
int timeOutInSeconds = 20 * 60;
AndroidDriver driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, TimeSpan.FromSeconds(timeOutInSeconds));
Both Appium and Selenium driver in Ruby don't allow user to customize HTTP timeout, see code. Therefore, in order to set custom timeout, user has to edit driver.rb inside ruby gem directory
timeout: 20 * 60 * 1000
const driver = wd.promiseChainRemote(serverConfig)
Selenium / PHP
$desired_caps_android_app = array(
'host' => $auth,
'port' => 80,
'desiredCapabilities' => ...,
'seleniumServerRequestsTimeout' => 120 )