<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chaoyi Chen on Medium]]></title>
        <description><![CDATA[Stories by Chaoyi Chen on Medium]]></description>
        <link>https://medium.com/@chenchaoyi?source=rss-48716ad351f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Ig1NmIEes2drERhh.</url>
            <title>Stories by Chaoyi Chen on Medium</title>
            <link>https://medium.com/@chenchaoyi?source=rss-48716ad351f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 23 May 2026 06:46:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chenchaoyi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[iOS Test Automation @WalmartLabs]]></title>
            <link>https://medium.com/walmartglobaltech/ios-test-automation-walmartlabs-d8668d85a27?source=rss-48716ad351f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8668d85a27</guid>
            <dc:creator><![CDATA[Chaoyi Chen]]></dc:creator>
            <pubDate>Fri, 10 Feb 2017 16:07:00 GMT</pubDate>
            <atom:updated>2017-02-10T16:07:00.813Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HAjCNjicWo11YsDZh3fBYw.jpeg" /></figure><p>In the article, <a href="https://medium.com/walmartlabs/elements-of-successful-massive-scale-automated-testing-f071c17f2907#.y4qn9hf9q"><em>Elements of Successful Massive Scale Automated Testing</em></a>, UI automation testing in general has been summarized as <strong><em>just plain sucks</em></strong>, which is <strong><em>doubly true</em></strong> when it comes to mobile.</p><p>However, the article also lays out the test automation process strategies here at WalmartLabs: <strong>Massive Parallelism</strong>,<strong> Early Stage Testing </strong>and<strong> Deterministic Behavior. </strong>In this article, we’ll take a a closer look how Walmart iOS test automation makes effort to achieve these three basics and serves as a <strong>fast feedback system</strong> to the developers.</p><h4>The Big Picture</h4><p>Walmart iOS Application is modularized into different components: Search and Browse, Cart, Pharmacy, In Store etc., developed by different teams, with different selection of technology stack. Here we will use the Cart component which is written in <a href="https://medium.com/walmartlabs/react-native-at-walmartlabs-cdd140589560#.q1yzcqyoh"><strong>React Native</strong></a> as an example.</p><p>The iOS automation test solution we provided within WalmartLabs is based on <a href="http://appium.io"><strong>Appium</strong></a> and its Javascript client. Test cases are written in Node.js and run with <a href="http://mochajs.org">Mocha</a>. We chose a Javascript binding solution not only because of the React Native technology stack choice in the Cart component, but we also want to align with our Web frontend automation test solution which is also in Node.js, and make use of the toolchain provided by <a href="http://testarmada.io/">TestArmada</a>, which we’ll see in the following.</p><p>For the test execution, we use <a href="http://saucelabs.com">SauceLabs</a>’ cloud-based platform so we could be exempt from all the virtual machines and different versions of iOS simulators maintenance.</p><h4>From Slow to Parallel</h4><p>How does running mobile automation test in serial compared with in parallel at first glance?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbWc7OsaDXZCg_nOLFpN2g.jpeg" /></figure><p>Let’s take a closer look at a current CI job build log sample from React Native Cart team:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2oC7NGVI9DEXa6UkGudg_g.jpeg" /><figcaption>CI Job build log</figcaption></figure><p>There are 6 steps in this CI build triggered by a pull request:</p><ol><li>npm packages installation</li><li>Code linting</li><li>Unit test</li><li>Create React Native bundle</li><li>Copy it over to the application</li></ol><p>The last step is executing <strong><em>all 84 UI automation tests in parallel remotely in Sauce Labs’s virtual machines</em></strong>, which includes:</p><ul><li>Compress the application bundle and upload it to the remote cloud</li><li>Wait for VMs in the cloud to start up and initiate simulators of specified iOS version</li><li>Install the uploaded bundle to the simulator</li><li>Start test execution in parallel with 3 automatic failure retries</li></ul><p>How long does it take? With the help of <strong>Magellan</strong>, it is in the order of <strong>10 minutes</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlFi-hj8i7tlqB8k8C-DkA.png" /><figcaption>Test result analytics dashboard</figcaption></figure><p>Magellan spins 84 parallel workers (processes), which makes all test cases run at the same time. As the developers continue to add more test coverage, we monitor the test result analytics dashboard (which is another TestArmarda tool integrated with Magellan called <a href="https://github.com/TestArmada/bloop"><strong>Bloop</strong></a>) closely and adjust the Magellan parallel worker number and CI structure in time.</p><h4>From Flaky to Deterministic Behavior</h4><p>This is probably the most tricky part in the mobile world. Especially for an application that interacts with so many different kinds of backend services. A carefully designed deterministic test scenario is not enough. Automatically retry is not ideal or enough either. Services flakiness is still like a ghost, it will keep haunting the tests unless you eliminate them with <strong>mocking</strong>.</p><p>We use <strong>Shifu</strong>, a WalmartLabs home grown mocking solution to achieve this. Simply said, it starts a mocking server with pre-recorded dummy data to replace the real services. The tricky part lays in two parts:</p><ul><li>Remember we use Magellan to execute all tests in parallel. How to route different responses to the same backend service URL for different test cases in parallel? e.g. Test A needs 6 different items in the Cart, while Test B needs empty cart. They both hit get cart backend service at the same time, but obviously they need to receive different mocked responses to populate the cart. Currently we start one Shifu mock server for each test at a different port. Luckily Magellan has such a <a href="https://github.com/TestArmada/magellan#features">network port management feature</a> to help to easily assign mocking port to each parallel process.</li><li>How to tell the mobile application to hit the mock server with the assigned port instead of real services? When starting an application in simulator, we can pass in process arguments. e.g.: -mockingUrl=localhost:13000, which gets saved into an object from <a href="https://developer.apple.com/reference/foundation/userdefaults">NSUserDefaults class</a>, that’s where we tell the application to use this value instead of real services for specific backend service calls.</li></ul><blockquote><em>We will have a deep dive </em>series<em> on the mocking techniques used here at WalmartLabs. Stay tuned.</em></blockquote><h4><strong>From Chaos to Early Stage Testing</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2oHIbqfx5YqWXCtR1i6vBQ.jpeg" /><figcaption>CI build sample screenshot</figcaption></figure><p>React Native Cart team has made UI automation tests run for every single Pull Request, which provides very early feedback as well as <strong>confidence</strong> to the developers. Plus all the tests were written by the developers themselves, who have full control over test coverage and are able to respond to test failures very quickly.</p><h4>Test Result Feedback</h4><p>To present the test result back to the developers, we use <a href="https://github.com/TestArmada/admiral"><strong>Admiral</strong></a> dashboard, another open source tool TestArmada provides.</p><p>The following screenshot is the overview page for the React Native Cart project. It shows the big picture for test result of each PR verification:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcxgtxd_ahgNF5u_SRM5uA.png" /><figcaption>PR test result overview page</figcaption></figure><p>If you click on any of the PR links from the overview page, you’ll find all the test cases results for this single PR verification:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xEYOB8EsYKW8Asy4gAv3Vg.png" /><figcaption>Test result details page</figcaption></figure><p>Furthermore, if you click on any one of the test result, you’ll see the details of that test run, including CI environment information. And since Admiral is able to embed the Sauce Labs test result link, information like Appium commands and logs, and even the screencast replay could be seen for this single UI test:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*NIYEzWGkFfJFuSkWUGTpVg.jpeg" /><figcaption>Single test result page</figcaption></figure><p>As we can see, the Admiral dashboard provides an one-in-all place for everyone that needs test results information in different levels. For any test failure, all the debug information has been included. Most people directly go to the replay to see how the test actual failed.</p><h4>Summary</h4><p>At WalmartLabs, iOS automation UI test:</p><ul><li>Use <strong>Magellan</strong> and cloud based solution to achieve massive parallelism.</li><li>Use <strong>Shifu</strong> mocking to achieve deterministic behavior.</li><li>It is promoted as a <strong>Pull Request blocker</strong> to provide early stage testing result feedback.</li><li>Test results and all related information are shown from <strong>Admiral</strong> dashboard.</li><li>Test cases execution statistics can be analyzed from analytics dashboard <strong>Bloop</strong> for further efficiency improvement.</li></ul><h4>What’s next</h4><p>For React Native team, there shouldn’t be any hold back to adopt the same Appium tests for Android UI testing too. We are looking into running Android automation tests in parallel remotely in Sauce Labs emulators along with iOS tests.</p><p>We believe there is still room to squeeze time from each test run, through improved UI element locator strategy.</p><p>We want to encourage other mobile application tenants to adopt the same approaches too.</p><p>We are applying the same strategy to real device farm testing which is coming soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8668d85a27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/walmartglobaltech/ios-test-automation-walmartlabs-d8668d85a27">iOS Test Automation @WalmartLabs</a> was originally published in <a href="https://medium.com/walmartglobaltech">Walmart Global Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The options of inspecting iOS 10 app with Appium 1.6]]></title>
            <link>https://medium.com/@chenchaoyi/the-options-of-inspecting-ios-10-app-with-appium-1-6-534ba166b958?source=rss-48716ad351f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/534ba166b958</guid>
            <category><![CDATA[appium]]></category>
            <category><![CDATA[mobile-test-automation]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[selenium]]></category>
            <dc:creator><![CDATA[Chaoyi Chen]]></dc:creator>
            <pubDate>Mon, 31 Oct 2016 07:32:09 GMT</pubDate>
            <atom:updated>2017-05-02T23:05:22.400Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Edit 5/1/2017:</blockquote><blockquote>It has been 6 months since this article was published, and the <a href="https://github.com/appium/appium-desktop"><strong><em>official</em></strong> Appium inspector</a> has been released. I have tried using it extensively with iOS apps. While I myself still miss some of the features provided by the old inspector (try out a self-constructed locator etc.), overall I am quite satisfied with it. So if you are seeing this, I would recommend using the official Appium inspector as your first choice.</blockquote><h3>Background</h3><p><a href="http://appium.io/"><strong>Appium</strong></a> is an open source test automation framework for mobile apps. It has the similar concept as <a href="https://w3c.github.io/webdriver/webdriver-spec.html">Selenium WebDriver</a>. For iOS, underlayer, it uses Xcode’s instrument tool UIAutomation to drive the UI operation on the app.</p><p>Apple <a href="https://developer.apple.com/videos/play/wwdc2015/102/">introduced XCUITest</a> in <strong>Xcode 7</strong> back in 2015. And in <strong>Xcode 8</strong>, Apple took one step further to remove the previous UI test tool UIAutomation. This leads Appium to overhaul its underlayer mechanism to use Facebook’s <a href="https://github.com/facebook/WebDriverAgent">WebDriverAgent</a> which implements most of the WebDriver protocol using XCUITest. This has been released as <a href="https://github.com/appium/appium/releases/tag/v1.6.0">Appium 1.6.0</a> recently.</p><p><strong><em>In a word, to test an app in iOS 10 with Appium, we have to use Xcode 8 or newer with Appium 1.6 or newer.</em></strong></p><p>However, <a href="https://github.com/appium/appium-desktop">the <strong><em>official</em></strong> inspector</a> for Appium 1.6 is not there yet. Obviously, it is not ideal to use the client’s <a href="https://w3c.github.io/webdriver/webdriver-spec.html#getting-page-source">get page source</a> method to get the entire source tree of the current view then manually extract the element locator. People still need a GUI like inspector to easily identify the locator of the element to build up Appium tests.</p><p>To do this, we actually have three options currently:</p><p><em>Note: the following are based on macOS system.</em></p><h4>1. The good old Appium inspector, with a bit workaround</h4><p>In the Appium GUI, iOS settings:</p><ul><li><strong>App Path: </strong>select the path to your app that needs to be inspected</li><li><strong>Force Device:</strong> select <em>iPhone 7</em></li><li><strong>Platform Version:</strong> manually<em> input 10.1</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZRhSGcvt8m4GoERBTp6rA.jpeg" /></figure><p>Then <strong>DON’T click on Launch</strong> to start Appium server through the GUI. Instead, do a npm install appium then start Appium 1.6 server in your terminal:</p><pre>$ npm install appium<br>$ ./node_modules/.bin/appium</pre><p>Once the Appium server starts, click on the Inspector icon on the GUI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pHC8U41LBR6eflgjfTjkYQ.jpeg" /></figure><p>Then that’s it. Wait for a while, you’ll see Appium first installs WebDriverAgent into the simulator, then the app you want to inspect. And Appium Inspector will open with the full <strong>XCUIElementType</strong> locator information you are looking for:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGYawVPYRE_0yQ49BpShrQ.jpeg" /></figure><h4>2. A new web based inspector maintained by Macaca team</h4><p>This is a slick <a href="https://macacajs.github.io/app-inspector/">web based inspector</a> created by the <a href="http://macacajs.github.io/macaca/">Macaca</a> team, that is from the mighty <a href="https://github.com/alibaba"><strong>Alibaba Inc</strong></a><strong>. </strong><em>Macaca</em><strong> </strong>basically provides a full suites of open source solutions based on Selenium WebDriver, for both Web and mobile. This inspector is just one of the tools.</p><p><em>I met some of the maintainers back in July 2016. They are a bunch of very talented engineers who spend their extra hours on this project. If you are interested, I do recommend playing around with their tools.</em></p><p>Back to the inspector. Here are the steps to set it up:</p><ul><li>Find the UDID for the simulator where you want to install and inspect the app:</li></ul><pre>$ xcrun simctl list</pre><ul><li>Install Macaca inspector:</li></ul><pre>$ npm install app-inspector</pre><ul><li>Start Macaca inspector with the simulator’s UDID, e.g.:</li></ul><pre>$ ./node_modules/.bin/app-inspector -u 6EE5E44A-F4F2-4A8A-AB5C-7A7FC9CC3512</pre><ul><li>Install the app to the booted simulator, e.g.:</li></ul><pre>$ xcrun simctl install 6EE5E44A-F4F2-4A8A-AB5C-7A7FC9CC3512 ~/Downloads/MultiSelectTableView.app/</pre><ul><li>Then go to the link showed from the terminal and start to inspect the app:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knDnYUMROAgYE0y8l4-EJw.png" /></figure><h4>3. A new web based inspector inspired by Selendroid Inspector</h4><p>This is another <a href="https://github.com/mykola-mokhnach/Appium-iOS-Inspector">new Appium iOS Inspector</a> created by <a href="https://github.com/mykola-mokhnach">Mykola Mokhnach</a> who is an active contributor to both Appium and WebDriverAgent projects, including the very anticipated <a href="https://github.com/facebook/WebDriverAgent/pull/308">https://github.com/facebook/WebDriverAgent/pull/308</a></p><p>I haven’t tried it out by myself, but based on feedback from the Appium forums, it definitely works. It requires to use a bootstrap Appium test to load the app into simulator and set break point to where you want to inspect the UI so you can go to the web browser to inspect it.</p><h4>Conclusion</h4><p>While I like the idea of web based inspector, both are missing a convenient feature to the majority of testers: <strong>automatic app installation</strong>.</p><ul><li>Macaca needs to manually extract the UDID and install the app using <em>xcrun</em>. I opened a <a href="https://github.com/macacajs/app-inspector/issues/20">feature request issue</a> several month back, but was turned down.</li><li>Mykola Mokhnach’s inspector needs to execute an Appium test then set a break point so you can continue to inspect.</li></ul><p>So, for a one-in-all Appium inspector solution, I would stay with option 1 for now.</p><p>Let me know if you have any better solution. Happy automating.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=534ba166b958" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>