<?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 Balaji Ganesh on Medium]]></title>
        <description><![CDATA[Stories by Balaji Ganesh on Medium]]></description>
        <link>https://medium.com/@gbalajee-ganesh?source=rss-864c81e3e1d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wevRcXFDq6z454-p</url>
            <title>Stories by Balaji Ganesh on Medium</title>
            <link>https://medium.com/@gbalajee-ganesh?source=rss-864c81e3e1d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 18:52:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gbalajee-ganesh/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[Generic way to perform TouchActions in the devices using Selenium/Appium.]]></title>
            <link>https://medium.com/swlh/generic-way-to-perform-touchactions-in-the-devices-using-selenium-appium-196ba18e3a87?source=rss-864c81e3e1d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/196ba18e3a87</guid>
            <category><![CDATA[appium]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[mobile-automation-testing]]></category>
            <dc:creator><![CDATA[Balaji Ganesh]]></dc:creator>
            <pubDate>Wed, 28 Apr 2021 04:55:08 GMT</pubDate>
            <atom:updated>2021-04-28T04:55:08.622Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Perform swipe action on real devices, emulators/simulators irrespective of platform and devices/device size.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*dXDhC_qZ4Q4THB7hNAURGA.jpeg" /><figcaption>Swipe actions in mobile devices</figcaption></figure><p>Here, I will walk you through the code which will help you perform gestures on any device irrespective of the platform and device&#39;s size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*UoF_GsFBmo-OPc9li2aL3g.png" /><figcaption>Device screen dimensions</figcaption></figure><p>As you can see for the mobile the origin is on the top left corner of the screen and the width of the device is the x-axis and the height is the y-axis. What we will do here is to play with these x and y values to achieve the gestures.</p><p>To start with, let&#39;s define the set of pointers according to your swipe action(in percentage). Let&#39;s take <strong>Swipe Down </strong>action first.</p><p><strong>SWIPE DOWN</strong></p><p>The starting point for the swipe-down action will be 50% of the x-axis (horizontal center of the screen) and 30% of the y-axis and the endpoint will be 50% of the x-axis (horizontal center of the screen) to 80% of the y-axis. These values can be tweaked based on your need. Let&#39;s define them in an integer array as shown below:</p><pre>/* Swipe down START and END percentage */</pre><pre>int[] SWIPE_DOWN_START = {50, 30};<br>int[] SWIPE_DOWN_END = {50, 80};</pre><p>Now that we have defined the start and end positions for the swipe action, let&#39;s get the device dimensions and compute the actual screen position.</p><p>To get the device dimension dynamically :</p><pre>Dimension screenSize = driver.manage().window().getSize();</pre><p>Let&#39;s take a device with screen size 1440 x 3120 px, then the x value for the swipe-down action will be 50% * 1440 = 720 and then the y-axis value will be 30% * 3120 and 80% * 3120 which will be 936 and 2496 respectively. The final coordinates for this case will be (720,936) and ( 720,2496).</p><p>Now that we have computed the start and the end coordinates for the action all we have to do is perform the swipe.</p><p>The function below will compute the screen coordinates for the action :</p><pre>private void swipePercentage(int[] from, int[] to) {<br>    Dimension screenSize = driver.manage().window().getSize();<br>    int[] start = this.getDeviceScreenCoordinates(screenSize, from);<br>    int[] end = this.getDeviceScreenCoordinates(screenSize, to);<br>    this.swipe(start, end);<br>}</pre><pre>private int[] getDeviceScreenCoordinates(Dimension screenSize, int[] cords) {<br>    int x = (int) (screenSize.getWidth() * ((float) cords[0] / 100));<br>    int y = (int) (screenSize.getHeight() * ((float) cords[1] / 100));<br>    return new int[]{x, y};<br>}</pre><p>The swipe method below will perform the touch actions on the device, If you notice :</p><pre>private void swipe(int[] from, int[] to) {<br>    TouchAction action = new TouchAction((PerformsTouchActions) driver);<br>    if (platformType.equalsIgnoreCase(&quot;ios&quot;)) {<br>        action.longPress(PointOption.<em>point</em>(from[0], from[1]));<br>    } else {<br>        action.press(PointOption.<em>point</em>(from[0], from[1]));<br>    }<br>    action.waitAction(WaitOptions.<em>waitOptions</em>(Duration.<em>ofMillis</em>(0)))<br>            .moveTo(PointOption.<em>point</em>(to[0], to[1]))<br>            .release()<br>            .perform();<br>}</pre><p>I have further improvised this by dynamically performing the swipe until the element is visible/matches the expectation condition.</p><pre>int maxScroll = 10;</pre><pre>public void checkIfDisplayedWithScrollDown(MobileElement element) throws Exception {<br>    By elem = this.convertMobElemToBy(element);<br>    int scroll = 0;<br>    double normalizer = 1;<br>    while (!(driver.findElements(elem).size() &gt; 0) &amp;&amp; scroll &lt;= maxScroll) {<br>        this.swipeUp(normalizer);<br>        scroll++;<br>    }<br><br>    if (scroll &gt; maxScroll) {<br>        throw new Exception(&quot;Element not found after &quot; + maxScroll + &quot;scrolls&quot;);<br>    }<br>}</pre><p>Full code to perform the gesture:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ea444bf0b675059f11422e5ace41ed5/href">https://medium.com/media/9ea444bf0b675059f11422e5ace41ed5/href</a></iframe><p>I have made use of something called <em>normalizer </em>in the above script, It is a value ranging from 0 to 1, when you change the normalizer value you can perform actions on different areas of the screen.</p><p><strong>Tip: </strong>In android, under your “Developer Options” -&gt; Enable “Pointer Location”. This will help you understand how the gesture is getting executed in the devices. I don’t think we have anything equivalent in iOS devices, but appium desktop can help to an extent.</p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=196ba18e3a87" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/generic-way-to-perform-touchactions-in-the-devices-using-selenium-appium-196ba18e3a87">Generic way to perform TouchActions in the devices using Selenium/Appium.</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple way to perform REST API Automation with Rest Assured, BDD, Java]]></title>
            <link>https://medium.com/swlh/simple-way-to-perform-rest-api-automation-with-rest-assured-bdd-java-a942d48c646d?source=rss-864c81e3e1d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a942d48c646d</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[cucumber]]></category>
            <category><![CDATA[restassured]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Balaji Ganesh]]></dc:creator>
            <pubDate>Tue, 25 Aug 2020 08:34:39 GMT</pubDate>
            <atom:updated>2020-08-25T08:50:51.567Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, let see how to quickly setup a REST api automation framework with Rest Assured and Cucumber 6.</p><p>To setup a cucumber project refer the link below :</p><p><a href="https://medium.com/swlh/a-java-project-with-cucumber-6-testng-and-maven-c58990d2bcff">A Java Project With Cucumber 6, TestNG and Maven.</a></p><p>Assuming, you have setup the BDD project, your project should look something like below. Additionally create a folder called requests under the resources directory :</p><pre>├── pom.xml<br>└── src<br>   └── test<br>      ├── java<br>         └── StepDefs<br>      └── resources<br>         └── features<br>         └── requests</pre><p><strong>Maven</strong> <strong>Dependencies :</strong></p><ol><li><a href="http://rest-assured.io/"><strong>Rest Assured</strong></a> : Testing and validating REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of using these languages into the Java domain.</li><li><strong>Rest Assured JSON Path</strong> : This is used to read the JSON response returned by Rest Assured. This plugin is based on groovy language.</li><li><a href="https://jknack.github.io/handlebars.java/"><strong>Handlebars</strong></a> : Handlebars provides the power necessary to let you build semantic templates effectively with no frustration. Here, we are going to build our request using handlebars.</li></ol><p>Below are the dependancies that you may have to add into your pom.xml :</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;<br>    &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;<br>    &lt;version&gt;4.1.2&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;<br>    &lt;artifactId&gt;json-path&lt;/artifactId&gt;<br>    &lt;version&gt;4.1.2&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;<br>    &lt;artifactId&gt;json-simple&lt;/artifactId&gt;<br>    &lt;version&gt;1.1.1&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;<br>    &lt;artifactId&gt;groovy&lt;/artifactId&gt;<br>    &lt;version&gt;2.5.8&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;com.github.jknack&lt;/groupId&gt;<br>    &lt;artifactId&gt;handlebars&lt;/artifactId&gt;<br>    &lt;version&gt;4.1.0&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>My API details are as follows :</p><pre><strong>URL</strong> : <a href="http://localhost:3000/login">http://localhost:3000/login</a></pre><pre><strong>Request Body : <br></strong>{<br>   &quot;username&quot; : &quot;&quot;,<br>   &quot;password&quot; : &quot;&quot;<br>}</pre><pre><strong>Expected Response</strong> :<br>{<br>   &quot;token&quot; : &quot;&quot;,<br>   &quot;user&quot; : {<br>      &quot;role&quot; : &quot;&quot;,<br>      &quot;email&quot; : &quot;&quot;<br>    }<br>}</pre><p>Now that we have our dependacies added lets write our feature file and step definition for the above request :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1032a105351e4ef7545f614b960c08fe/href">https://medium.com/media/1032a105351e4ef7545f614b960c08fe/href</a></iframe><p>Create a new file called “login.json” (in my case) under “src/test/resources/ request” directory and parameterize the values based on your need like below :</p><pre>{<br>   &quot;username&quot; : &quot;{{username}}&quot;,<br>   &quot;password&quot; : &quot;{{password}}&quot;<br>}</pre><p>Lets now prepare the rest processor, copy the following code into a class class called Rest Processor :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b808a0fad4667a3b62d188131d662010/href">https://medium.com/media/b808a0fad4667a3b62d188131d662010/href</a></iframe><p>This is a single class which will process GET, POST, PUT, DELETE rest methods.</p><p>You can alternatively clone my git repository from the link below, which contains all the above mentioned code along with the integration for Retry Listeners and Extent Report.</p><p><a href="https://github.com/gbalaji94/RestAssured">gbalaji94/RestAssured</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a942d48c646d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/simple-way-to-perform-rest-api-automation-with-rest-assured-bdd-java-a942d48c646d">Simple way to perform REST API Automation with Rest Assured, BDD, Java</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[iOS Automation With Appium Desktop for Real Devices/Simulators]]></title>
            <link>https://medium.com/swlh/ios-automation-with-appium-desktop-for-real-devices-simulators-41539b0439f1?source=rss-864c81e3e1d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/41539b0439f1</guid>
            <category><![CDATA[ios-apps]]></category>
            <category><![CDATA[appium]]></category>
            <category><![CDATA[appium-desktop]]></category>
            <category><![CDATA[ios-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <dc:creator><![CDATA[Balaji Ganesh]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 17:34:54 GMT</pubDate>
            <atom:updated>2020-08-21T00:15:02.666Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial is to start/set up your environment for iOS Automation. Here, we will be doing it with an Appium desktop instead of appium as an npm package.</p><h4>Why Appium Desktop? :</h4><p>Appium Desktop is an app for Mac, Windows, and Linux which gives you the power of the <a href="http://appium.io/">Appium</a> automation server in a beautiful and flexible UI. It is a combination of a few Appium-related tools:</p><ul><li>A graphical interface for the Appium Server. You can set options, start/stop the server, see logs, etc… You also don’t need to use Node/NPM to install Appium, as the Node runtime comes bundled with Appium Desktop.</li><li>An Inspector that you can use to look at your app’s elements (Safari/Chrome browser, native or hybrid app), get basic information about them, and perform basic interactions with them. This is useful as a way to learn about Appium or as a way to learn about your app so you can write tests for it.</li></ul><h4>System Requirements :</h4><ol><li>Mac OS High Sierra (10.13) (or higher)</li><li>A 64 bit CPU</li></ol><h4>System setup :</h4><h4><a href="https://developer.apple.com/xcode/">Xcode</a></h4><p><strong>Xcode</strong> is an integrated development environment (IDE) for macOS containing a suite of software development tools developed by Apple for developing software for macOS, iOS, iPadOS, watchOS, and tvOS. You can install it from <a href="https://developer.apple.com/xcode/">here</a>.</p><h4><a href="https://brew.sh/">Homebrew</a></h4><p>Homebrew is a package management software that will make it much simpler for us to install a few other software. You can install it from <a href="https://brew.sh/">here</a>.</p><h4><a href="https://github.com/Carthage/Carthage">Carthage</a></h4><p>Carthage builds your dependencies and provides you with binary frameworks, its needed by the WebDriverAgent. Use the following command to install :</p><pre>brew install carthage</pre><h4><a href="https://github.com/ios-control/ios-deploy">ios-deploy</a></h4><p>ios-deploy is a utility to install and debug iPhone apps from the command line, without using Xcode. In terminal, run the following command :</p><pre>brew install ios-deploy</pre><h4><a href="https://github.com/libimobiledevice/ideviceinstaller">ideviceinstaller</a></h4><p>ideviceinstaller is a tool to interact with the installation_proxy<br>of an iOS device allowing to install, upgrade, uninstall, archive the iOS applications. In terminal, run the following command :</p><pre>brew install ideviceinstaller</pre><h4><a href="https://github.com/google/ios-webkit-debug-proxy"><strong>ios_webkit_debug_proxy</strong></a></h4><p>Appium uses this tool to access web views on real iOS devices. In terminal, run the following command :</p><pre>brew install ios-webkit-debug-proxy</pre><h4><strong>Optional : </strong>Node JS and npm</h4><p>Installing node is completely optional beacuse node runtime comes bundled with Appium Desktop.</p><p>Node is a javascript run-time environment and npm is the node package manager. In terminal, run the following command :</p><pre>brew install node</pre><h4><a href="https://github.com/appium/appium-desktop/releases">Appium Desktop</a></h4><p>You can install the Appium desktop from <a href="https://github.com/appium/appium-desktop/releases">here</a>. You can read more about appium desktop from the following link : <a href="https://github.com/appium/appium-desktop">https://github.com/appium/appium-desktop</a></p><p>After you install all the above mentioned dependancies, we are good to start with the setting up the WebDriverAgent.</p><h4><a href="https://github.com/facebookarchive/WebDriverAgent"><strong>WebDriverAgent</strong></a></h4><p>WebDriverAgent is a <a href="https://w3c.github.io/webdriver/webdriver-spec.html">WebDriver server</a> implementation for iOS that can be used to remote control iOS devices. It allows you to launch &amp; kill applications, tap &amp; scroll views or confirm view presence on a screen. This makes it a perfect tool for application end-to-end testing or general purpose device automation. It works by linking XCTest.framework and calling Apple&#39;s API to execute commands directly on a device. WebDriverAgent is developed and used at Facebook for end-to-end testing and is successfully adopted by <a href="http://appium.io/">Appium</a>.</p><p>In short WebDriverAgent is Mobile JSON wire protocol through which you can communicate with the iOS Device.</p><p>Before we continue with WebDriverAgent setup, make sure you have the <strong>Apple developer Accout</strong>. Without the developer account we may not be able to build the WebDriverAgent successfully.</p><p><strong>Steps to build WebdriverAgent :</strong></p><ol><li><strong>Lauch the appium desktop application.</strong></li><li><strong>Start the server.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUozacvV3xuz0FRef60msA.png" /><figcaption>Appium Desktop</figcaption></figure><p>3. <strong>Connect your iOS Device to your system through USB.</strong></p><p>4. <strong>Click on the Appium inspector icon.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b9gMnxkwxfnCroo6Hx3vTQ.png" /><figcaption>Appium Inspector Icon</figcaption></figure><p>You will see a screen that looks like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUvbHEHYMiUcAK3ytqLk8A.png" /><figcaption>Appium Inspector</figcaption></figure><p>5. <strong>Choose “Automatic Server”.</strong></p><p>6.<strong> Prepare the desired capability based on your device configuration :</strong></p><pre>{<br>  &quot;deviceName&quot;: &quot;iPhone&quot;,<br>  &quot;platformName&quot;: &quot;iOS&quot;,<br>  &quot;platformVersion&quot;: &quot;13.6&quot;,<br>  &quot;automationName&quot;: &quot;XCuiTest&quot;,<br>  &quot;udid&quot;: &quot;&lt;YOUR-DEVICE-UDID&gt;&quot;,<br>  &quot;bundleId&quot;: &quot;&lt;YOUR-APPLICATION-BUNDLE-ID&gt;&quot;,<br>  &quot;xcodeOrgId&quot;: &quot;&lt;YOUR-XCODE-ORG-ID&gt;&quot;,<br>  &quot;xcodeSigningId&quot;: &quot;iPhone Developer&quot;<br>}</pre><p>To get the xcodeOrgId follow the steps below :</p><ol><li>Go to <a href="https://developer.apple.com/account">https://developer.apple.com/account</a></li><li>Login with you Apple developer account.</li><li>Click Membership in the sidebar.</li><li>Your Team ID appears in the Membership Information section under the team name.</li></ol><p>Once you have the desired capability JSON ready :</p><ol><li>Click on the edit icon in the JSON Representation section.</li><li>Replace “{}” with the JSON that you have prepared.</li><li>Click on the save button.</li><li>Your screen should look like this now :</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7M6xssIIE8Z6MbKd7pzMGw.png" /><figcaption>Appium Inspector with Desired Capabilites</figcaption></figure><p>You can save these capabilites by clicking on the Save As button, before we continue with the next steps.</p><p>7. <strong>Click on the “Start Session” button, but there are going to be some failures lets fix them as we continue with the tutorial.</strong></p><p>8. <strong>Notice you appium terminal, you will see some lines like below</strong></p><pre>[WebDriverAgent] Beginning test with command &#39;xcodebuild build-for-testing test-without-building -project<br> /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/bio-india/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp -destination id=13435433-000514680A83002E IPHONEOS_DEPLOYMENT_TARGET=13.6 -xcconfig /var/folders/g3/4bgm1zrj74z3chm8vwwrkpjw0000gp/T/2020719-9679-167r3lc.acxv/appium-temp.xcconfig GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO&#39; in directory &#39;/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent&#39;</pre><p>9. From the above lines you can get the path to the WebDriverAgent.xcodeproj which is :</p><pre>/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj</pre><p>10. <strong>Open a terminal and run the following command</strong> :</p><pre>open /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj</pre><p>Now you will see Xcode starting with your <strong>WebDriverAgent.xcodeproj</strong></p><p>Once the Xcode is launched, <strong>add you developer credentials to Xcode</strong> with the steps below :</p><ol><li>Click on the<strong> Xcode</strong> Menu &gt; <strong>Preferences</strong>, Alternatively you can also use the below shortcut to go to the preferences</li></ol><pre>Command + ,</pre><p>2. Click on the <strong>Accounts </strong>tab</p><p>3. Click on the “+” icon and provide your developer credentials.</p><p>Once you have added your account you can then “Download your manual profiles”.</p><p>11. <strong>Configuring your WebDriverAgent</strong></p><p>Now that, we have opened the WebDriverAgent project in the xcode and we have added our developer credentials to the Xcode. Lets configure the WebDriverAgent.</p><p>Your screen should look something like this now (You may have some errors as well, which will get fixed with the below steps) :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xLBJHyj5aB0JZTDd1KkUQA.png" /><figcaption>Xcode Intial Screen</figcaption></figure><ol><li>Click on the WebDriverAgentRunner in the targets section, you can see that highlighted in the above screenshot.</li><li>Click on the “Signing &amp; Capabilities” tab.</li><li>Check the “Automatically manage signing” checkbox.</li><li>Choose your Team in the Team dropdown.</li><li>Now, you will notice that the errors are gone.</li><li>The last step here is to change the bundle id for the WebDriverAgentRunner, Click on “Build Setting” tab.</li><li>Search for “Product Bundle Identifier” and replace the value with a bundle identifier of your choice. For ex : “com.&lt;YOUR-ORG&gt;.wda.runner”</li></ol><p>We are now done with configuring the WebDriverAgent runner lets test this by building it.</p><p>Choose the WebDriverAgentRunner as the target application and choose your device as a target device. In this case I chose a simulator and click on the build button “Play Icon”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*m5BO8OZOCn4i1U2VOW3fbg.gif" /></figure><p>Now you will see the message “Build Succeded”. With this the WebDriverAgentRunner setup is complete and you can try restarting the session from your Appium Desktop. (Repeat step 7)</p><p>Now you may see a new error in the Appium Console. “xcodebuild exited with code ‘65’”. This is because your device doesnt trust the developer.</p><p><strong>To the trust the developer follow the below steps</strong> :</p><ol><li>Click on the “Start Session” button on the Appium Inspector.</li><li>Notice your mobile launcher, you will see a new App called WebDriverAgent Installed.</li><li>Go to the phone Settings &gt; General &gt; Device Management.</li><li>You will see you developer account in the list,</li><li>Choose that and Click on “Trust the developer”.</li></ol><p>Now you should see your application launched by the appium desktop and you can notice the same screen on the Appium Inspector as well.</p><h4>Conclusion</h4><p>You can use the same desired capabilities in you code to run the automated tests like below :</p><pre>DesiredCapabilities iosCapabilities = new DesiredCapabilities();<br>iosCapabilities.setCapability(MobileCapabilityType.<em>DEVICE_NAME</em>, &quot;&quot;);<br>iosCapabilities.setCapability(MobileCapabilityType.<em>PLATFORM_NAME</em>, &quot;&quot;);<br>iosCapabilities.setCapability(MobileCapabilityType.<em>PLATFORM_VERSION</em>, &quot;&quot;);<br>iosCapabilities.setCapability(MobileCapabilityType.<em>AUTOMATION_NAME</em>, &quot;&quot;);<br>iosCapabilities.setCapability(MobileCapabilityType.<em>UDID</em>, &quot;&quot;);<br>iosCapabilities.setCapability(MobileCapabilityType.<em>NO_RESET</em>, true);<br>iosCapabilities.setCapability(&quot;xcodeOrgId&quot;, &quot;&lt;YOUR-TEAM-ID&gt;&quot;);<br>iosCapabilities.setCapability(&quot;xcodeSigningId&quot;, &quot;iPhone Developer&quot;);<br>iosCapabilities.setCapability(&quot;bundleId&quot;, &quot;&quot;);<br>driver = new IOSDriver(new URL(&quot;http://127.0.0.1:4723/wd/hub&quot;), iosCapabilities);</pre><p>Alternatively if you wish to install the application into your device through appium you can use the capability mentioned below :</p><pre>iosCapabilities.setCapability(MobileCapabilityType.APP, &quot;&lt;IPA-FILE&gt;&quot;);</pre><p>Cheers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41539b0439f1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/ios-automation-with-appium-desktop-for-real-devices-simulators-41539b0439f1">iOS Automation With Appium Desktop for Real Devices/Simulators</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Java Project With Cucumber 6, TestNG and Maven.]]></title>
            <link>https://medium.com/swlh/a-java-project-with-cucumber-6-testng-and-maven-c58990d2bcff?source=rss-864c81e3e1d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c58990d2bcff</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[testng]]></category>
            <category><![CDATA[test-automation-framework]]></category>
            <category><![CDATA[cucumber]]></category>
            <dc:creator><![CDATA[Balaji Ganesh]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 06:07:59 GMT</pubDate>
            <atom:updated>2020-08-18T12:30:32.845Z</atom:updated>
            <content:encoded><![CDATA[<h3>What you’ll learn?</h3><p>To set up a simple java project with Cucumber 6, TestNG and Maven.</p><h3>Prerequisite :</h3><ol><li><a href="https://www.jetbrains.com/idea/download/">Intellij IDEA</a>, install a pluging called “<a href="https://plugins.jetbrains.com/plugin/7212-cucumber-for-java">Cucumber for Java</a>”.</li><li>JDK.</li></ol><h3>Cucumber :</h3><p>Cucumber is a framework available to write and test the application by using the high-level description of the software. It is a tool which is used frequently in projects which use Agile processes. It bridges the gap of communication across teams, reduced the workload of documentation and provides us with a common language which every stakeholder speaks and understands. Rather one of the main benefits of cucumber is that it allows a common collaborative document in which the application and end user behavior are captured. This document can be used by any team member and it will provide all the relevant information.</p><h4>Components</h4><p>The cucumber framework has three components :</p><ul><li>Features — to define application behaviour in plain meaningful English text using a simple grammar defined by a domain-specific language (DSL)</li><li>Step Definitions — A Step Definition is a Java method with an <a href="https://cucumber.io/docs/cucumber/step-definitions/#expressions">expression</a> that links it to one or more <a href="https://cucumber.io/docs/gherkin/reference#steps">Gherkin steps</a>. When Cucumber executes a <a href="https://cucumber.io/docs/gherkin/reference#steps">Gherkin step</a> in a scenario, it will look for a matching <em>step definition</em> to execute.</li><li>Test Runner — to automate and run the behaviour tests– e.g. <strong>TestNG (Java)</strong>, jUnit (Java)</li></ul><h3>Setting up the Project</h3><h4>1. Creating a Maven Project</h4><ol><li>Open your Intellij IDEA.</li><li>Click on File -&gt; New -&gt; Project.</li><li>Uncheck “Create from archetype”, If you prefer to use an archetype you can use <strong>maven</strong>-<strong>archetype</strong>-<strong>quickstart</strong>.</li><li>Provide a name for your project and click “Next”.</li><li>Your project structure will look like below :</li></ol><pre>├── pom.xml<br>└── src<br>   ├── main<br>      ├── java<br>      └── resources<br>   └── test<br>      └── java</pre><p>Now, you can delete the src/main/java directories and add a resources directory under test, under the resources directory create a new directory called as features and add a new package called StepDefs under src/test/java . Your new structure will look like :</p><pre>├── pom.xml<br>└── src<br>   └── test<br>      ├── java<br>         └── StepDefs<br>      └── resources<br>         └── features</pre><p>Now, that are folder structer is ready, lets look at the packages we need to setup a Cucumber Framework with TestNG.</p><p><strong>Maven Dependencies :</strong></p><ol><li><strong>cucumber-java</strong> — In this project we will be using dependancies from “io.cucumber” and not “info.cukes”. io.cucumber and info.cukes are Maven group ids. info.cukes was for Cucumber version till <strong>1.2.5</strong>. The latest version are in io.cucumber starting from <strong>2.0.0.</strong></li><li><strong>cucumber-testng</strong></li><li><strong>selenium-java</strong></li><li><strong>webdrivermanager </strong>— If you use <a href="http://docs.seleniumhq.org/projects/webdriver/">Selenium WebDriver</a>, you probably know that to use some browsers such as Chrome, Firefox, Edge, Opera, PhantomJS, or Internet Explorer, first you need to download the so-called <em>driver</em>, i.e. a binary file which allows WebDriver to handle browsers. In Java, the path to this driver must be set as JVM properties. This is quite annoying since it forces you to link directly this driver into your source code. In addition, you have to check manually when new versions of the binaries are released. WebDriverManager comes to the rescue, performing in an automated way all this dirty job for you.</li></ol><p><strong>Maven Plugins :</strong></p><ol><li><strong>maven-compiler-plugin</strong> — Sometimes when you may need to compile a certain project to a different version than what you are currently using. The javac can accept such command using “-source” and “-target”. The Compiler Plugin will help you acheive this by providing the details in you POM.xml.</li><li><strong>maven-surefire-plugin</strong> — This is used to trigger your tests and also provides a few reports.</li></ol><h4>POM.xml</h4><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;<br>         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;<br>    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br><br>    &lt;groupId&gt;org.example&lt;/groupId&gt;<br>    &lt;artifactId&gt;CucumberTests&lt;/artifactId&gt;<br>    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;<br>    &lt;build&gt;<br>        &lt;plugins&gt;<br>            &lt;plugin&gt;<br>                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>                &lt;version&gt;3.8.1&lt;/version&gt;<br>                &lt;configuration&gt;<br>                    &lt;source&gt;1.8&lt;/source&gt;<br>                    &lt;target&gt;1.8&lt;/target&gt;<br>                &lt;/configuration&gt;<br>            &lt;/plugin&gt;<br>            &lt;plugin&gt;<br>                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>                &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br>                &lt;version&gt;3.0.0-M1&lt;/version&gt;<br>                &lt;configuration&gt;<br>                    &lt;suiteXmlFiles&gt;<br>                        &lt;suiteXmlFile&gt;src/test/resources/Runner.xml&lt;/suiteXmlFile&gt;<br>                    &lt;/suiteXmlFiles&gt;<br>                &lt;/configuration&gt;<br>            &lt;/plugin&gt;<br>        &lt;/plugins&gt;<br>    &lt;/build&gt;<br>    &lt;dependencies&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.cucumber&lt;/groupId&gt;<br>            &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;<br>            &lt;version&gt;6.1.1&lt;/version&gt;<br>            &lt;scope&gt;test&lt;/scope&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.cucumber&lt;/groupId&gt;<br>            &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;<br>            &lt;version&gt;6.1.1&lt;/version&gt;<br>            &lt;scope&gt;test&lt;/scope&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;<br>            &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;<br>            &lt;version&gt;3.141.59&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;<br>            &lt;artifactId&gt;webdrivermanager&lt;/artifactId&gt;<br>            &lt;version&gt;4.0.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;<br>&lt;/project&gt;</pre><p>Now that you have all the dependacies added to your POM.xml, IDEA will automatically try to install these dependancies for you. If you want to run it manually, you can do it as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRXB4qm1GgqMrtj7Wtn8kA.png" /></figure><h4>2. Writing you first Feature File :</h4><p>A <strong><em>Feature File</em></strong> is an entry point to the <em>Cucumber</em> tests. This is a file where you will describe your tests in Descriptive language (Like English). It is an essential part of Cucumber, as it serves as an automation test script as well as live documents. A feature file can contain a scenario or can contain many scenarios in a single feature file but it usually contains a list of scenarios.</p><p>Lets now start by creating it Right click on the src/test/resources/features directory and New -&gt; File -&gt; FirstFeature.feature , make sure you provide the extension for the feature file.</p><p><strong>Keywords :</strong></p><p><strong><em>Feature, Backgournd, Scenario, Given, When, And and Then —</em></strong> These are keywords defined by <strong><em>Gherkin</em></strong>. <em>Gherkin</em> has few more keywords and I will make a new blog on those :). But to start off we can quickly explain some of the keywords in one line :</p><ul><li><strong>Feature</strong> − Name of the feature under test.</li><li><strong>Description</strong> (optional) − Describe about feature under test.</li><li><strong>Background </strong>− Used to define a step or series of steps that are common to all the tests in the feature file</li><li><strong>Scenario</strong> − What is the test scenario.</li><li><strong>Given</strong> − Prerequisite before the test steps get executed.</li><li><strong>When</strong> − Specific condition which should match in order to execute the next step.</li><li><strong>Then</strong> − What should happen if the condition mentioned in WHEN is satisfied.</li></ul><p><strong>FirstFeature.feature</strong></p><pre>Feature: Google Search<br><br>  Background: To Launch the browser<br>    Given Launch the browser<br><br>  Scenario: Search for Cucumber in Google<br>    When Hit Google on your browser<br>    Then Enter &quot;Cucumber&quot; in the search text box.<br>    And Select the first result.</pre><p>You can notice that in the contents in the feature file are higlighted. This is because there are no steps defined in the project for those. This is where our IDEA will start helping us to write the StepDefinitions.</p><p>Place you cursor at the end of “Given Launch the browser” and press OPTION + ENTER in Mac or ALT + ENTER in Windows. You will get two options now, I recommend you to use Create step definition over Create all step definitions . Now, you’ll see a pop-up where you have to provide the filename and here my filename is FirstStepDef</p><p>FileType I am using here is Java but if you are comfortable/wish to use lambda then you can choose Java 8. The last step is to provide the path to your StepDefs package.</p><p>Also, ensure that the step definition file is created under the right directory. If not move it to the correct destination. Now you can start writing your selenium code directly here or use Page Object Model to execute your tests on your browser as show below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGEEC7ZEi8ZKBDsJG1YR8Q.png" /></figure><p><strong>3. TestRunner</strong></p><p>With a cucumber-based framework, you cannot run a feature file on its own. You will need to create a java class, which in turn will run this cucumber feature file. We call this class as <strong>TestRunner</strong>. In addition to running a cucumber feature file, the test runner class also acts as an interlink between feature files and step definition classes. It is in test runner class, that you provide the path for both feature file and step defs.</p><p>Create a new package under src/test/java called as TestRunner and add the following code to it, incase you have you feature file/step definitions in a different folder then update the path here accordingly :</p><pre>import io.cucumber.testng.AbstractTestNGCucumberTests;<br>import io.cucumber.testng.CucumberOptions;<br>import org.testng.annotations.DataProvider;<br><br>@CucumberOptions(<br>        features = {&quot;src/test/resources/features&quot;},<br>        glue = {&quot;StepDefs&quot;},<br>        tags = &quot;&quot;<br>)<br>public class TestRunner extends AbstractTestNGCucumberTests {<br><br>    @Override<br>    @DataProvider(parallel = true)<br>    public Object[][] scenarios() {<br>        return super.scenarios();<br>    }<br>}</pre><p>You can also notice that we have used @DataProvider(parallel = true) this will run your tests in parallel. Maximum threads it can start at once is 10. For more infomation on parallel execution you can refer <a href="https://cucumber.io/docs/guides/parallel-execution/">here</a>.</p><p><strong><em>Note : </em></strong><em>We are extending “</em>AbstractTestNGCucumberTests<em>” which makes this a testNG class and you can use all the testNG annotations here.</em></p><p>You can now run this class directly or use a TestNG XML (trigger your test runner class) to start your test execution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c58990d2bcff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/a-java-project-with-cucumber-6-testng-and-maven-c58990d2bcff">A Java Project With Cucumber 6, TestNG and Maven.</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>