Optimizing WebDriverAgent Startup Performance
Some Appium users have asked me how to speed up their iOS exam, citing the length of clip it takes to start tests which use the WebDriverAgent library (all tryout utilise the XCUITest driver). Most of the perceived speed of an can & # x27; t be meliorate due to the base speed of booting simulator or the UI actions themselves. The slowest part, which user were asking me how to avert, is the initial startup of a test: the time between direct the first POST /session command and the response indicating that your test script can begin sending bidding. We & # x27; ll telephone this time period the & quot; session conception & quot; time. Let & # x27; s start with the most basic: This is essentially the default template we use for an iOS test in theAppiumPro sample code repository. We have our sampling app hosted on a web Url for convenience, a @ Before step which create a fresh session for each trial, an @ After footstep to delete the session at the end of each test, postdate by six tests which do nothing. Each of the six tests take12.8seconds on average. We can cut this down by two third! There are desired capabilities we can specify to greatly trim the clip it lead to create a session. Appium is establish to cater to a large number of device, for use in many different situations, but we likewise require to get sure that it is easy to get started automating your first trial. When specifying desired capabilities, Appium will canvas the state of your system and choose default values for every desired capability which you don & # x27; t specify. By being more specific, we can have Appium skip the work it does to choose the nonremittal values. Our first improvement is to set the app location to a file already on the host device. Downloading an app from a remote source is add3.9second to each test in the suite. Your test rooms probably already does things this way, but for our demo repository this really speeds thing up. Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script. Running the trial, it & # x27; s leisurely to notice that the app gets reinstalled on the simulator for each exam. This takes a lot of time and can be jump. You may have sure test which require a fresh install, or need all the app data cleaned, but those tests could be put into a separate suite, leaving the majority of tests to run faster by reusing the same app. Most user should be familiar with the noReset desired capability. This salvage an additional2.9seconds per test. That was the easy material, giving us an average startup time of6minute per test, but we can shave off another2.1seconds, which is a 35 % improvement. Appium uses the simctl commandline creature provided by Apple to match the deviceName desired capability to the udid of the simulator. We can skip this step by set the simulator udid ourselves. I looked through the logs of the previously run test and took the udid from there: This saves0.4moment per test. Appium likewise gets the bundle ID for your app by parsing the app & # x27; s plist. We can render the know bundle ID, again taking it from the logs of the last successful trial. This ends up saving us another0.1 seconds: When charge the WedDriverAgent server, Appium loads the file from wherever XCode saved it after compilation. This location is called the & quot; Derived Data Directory & quot; and Appium fulfill an xcodebuild bidding in order to get the locating. Again, we can look through the logarithm of the last test run and provision this value ourselves, allowing Appium to skip the employment of calculating it: This salvage a whopping1.4moment. While xcodebuild is useful, it hasn & # x27; t been optimized to supply this bit of information. The last optimisation is to specify the webDriverAgentUrl desired capability. If specified, Appium skips a step where it checks to do certain that there are no obsolete or abandoned WebDriverAgent processes however escape. The WebDriverAgent server needs to already be run at this position, so we can only use this desired capability after the first exam starts the host. So, what have we done? Using a local file and noReset reduced the fundament test clip from12.8seconds to6bit, making test startup53.3% faster. On top of that, we performed some more obscure optimizations to improve test times another23.9%, shaving off another1.3 seconds. Here & # x27; s a optic crack-up of what Appium spends its time doing during one of our trial: & quot; Remaining test time & quot; and & quot; session shutdown & quot; are all that remain in our optimized test: For all these tests, I kept the same simulator running. Starting up a simulator for the first test takes some extra clip. I also observe that the first test of every suite always takes a little bit longer even when the simulator is already running. For the timing statistics in this article, I omitted the initiative test from each run. None of them were that much longer than the average test, and the goal is to reduce total tryout suite time. If you have 100 test, an extra second on the first one doesn & # x27; t touch the full suite time much. That state, all this is splitting hairs, since as soon as your tryout contain more than a few commands, the amount of clip drop on inauguration is insignificant compared to the measure of time spend finding elements, look for aliveness, and loading assets in your app. Full example code locatedhere. For situations where a CI waiter is run Appium tests for the first time, further optimizations can be made to reduce the time spent compiling WebDriverAgent for the first test. We & # x27; ll discuss these in a future edition! Lead, Content Marketing, HeadSpin Inc. Piali is a active and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging tale and marketing collateral across various industries. She surpass in collaborating with cross-functional teams to develop innovative message strategy and deliver compelling, unquestionable, and impactful message that resonates with quarry hearing and enhances marque authenticity. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts..png)



Optimizing WebDriverAgent Startup Performance
AI-Powered Key Takeaways
private String APP = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.9.0/TheApp-v1.9.0.app.zip ''; @ Before public nothingness setUp () drop IOException {DesiredCapabilities crest = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` iOS ''); caps.setCapability (`` platformVersion '', `` 12.2 ''); caps.setCapability (`` deviceName '', `` iPhone Xs ''); caps.setCapability (`` automationName '', `` XCUITest ''); caps.setCapability (`` app '', APP); driver = new IOSDriverCheck:
Also check:
private String APP = `` /Users/jonahss/Workspace/TheApp-v1.9.0.app.zip '';See:
caps.setCapability (`` noReset '', true);Also see:
caps.setCapability (`` udid '', `` 009D8025-28AB-4A1B-A7C8-85A9F6FDBE95 '');Read:
caps.setCapability (`` bundleId '', `` io.cloudgrey.the-app '');caps.setCapability (`` derivedDataPath '', `` /Users/jonahss/Library/Developer/Xcode/DerivedData/WebDriverAgent-apridxpigtzdjdecthgzpygcmdkp '');Also read:
caps.setCapability (`` webDriverAgentUrl '', `` http: //localhost:8100 '');
individual String APP = `` /Users/jonahss/Workspace/TheApp-v1.9.0.app.zip ''; individual IOSDriver driver; private static Boolean firstTest = true; @ Before public void frame-up () throws IOException {DesiredCapabilities caps = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` iOS ''); caps.setCapability (`` platformVersion '', `` 12.2 ''); caps.setCapability (`` deviceName '', `` iPhone Xs ''); caps.setCapability (`` automationName '', `` XCUITest ''); caps.setCapability (`` app '', APP); caps.setCapability (`` noReset '', true); caps.setCapability (`` udid '', `` 009D8025-28AB-4A1B-A7C8-85A9F6FDBE95 ''); caps.setCapability (`` bundleId '', `` io.cloudgrey.the-app ''); caps.setCapability (`` derivedDataPath '', `` /Users/jonahss/Library/Developer/Xcode/DerivedData/WebDriverAgent-apridxpigtzdjdecthgzpygcmdkp ''); if (! firstTest) {caps.setCapability (`` webDriverAgentUrl '', `` http: //localhost:8100 '');} driver = new IOSDriverDon ’ t Rely on iOS Emulators & amp; Android Simulators.
Piali Mazumdar
Optimizing WebDriverAgent Startup Performance
4 Parts
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for advanced users (Part 3)
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for advanced users (Part 4)
Discover how HeadSpin can empower your business with superior testing capabilities







Discover how HeadSpin can empower your business with superior testing potentiality
Discover how HeadSpin can empower your business with superior testing capabilities
Connet Now


Automate This With SUSA
Test Your App Autonomously







.png)












