Make A Start With Appium


From the very beginning of my career as a software test engineer, I have always been hearing  the buzz around automation. All this has encouraged me to try my hands on this interesting and dominant field of testing. So, in this blog, I shall be sharing my experience and the challenges that I faced while trying to write my first automation script.

There are several tools to automate the mobile application test cases but Appium is the most widely used. So, I chose to use appium for the purpose. Appium is an open-source mobile app automation framework that supports both android and iOS testing. 

Let’s talk about the prerequisites to begin with automation testing in the appium framework.

One must have the following set of  softwares pre-installed on the system before starting with android application testing:Android Studio, Eclipse IDE and JAVA. The paths for environment variables of these softwares should be proper.

Also, install the dependencies likeTestNG, Appium, Selenium in java. Next, install the Appium desktop application.There are so many free tutorials available on the internet that can assist to set up these prerequisites. So, please feel free to get help from those as well.

Now we need an android application and a physical device on which we will run our automation scripts. I am using the “test.apk”(test for that purpose. First of all, open up the eclipse IDE and create a class with the name “base.java” as shown in the below image.

This base class shall have the information about the apk file path and the physical device which is connected via adb. To add more, it has all the other important capabilities which are essential for initializing a test script in appium framework.

Before moving to the next step, which is writing the test script we need to get the parameters like resource id, class etc of the element that is supposed to be automated. This can be achieved using  the UIautomatorViewer as depicted below. Just launch the UIautomatorViewer and take a screenshot of the desired screen where that element is present.  

In the next step, Let’s write another java class with the name “ basics.java” to write the test cases in the syntax driven by the appium framework. This java class shall find the element using the “findElementByXPath” and later perform actions like click, zoom, drag, etc on that particular element.

In the above image, a click button is automated. On running this script, it will install and then launch the test app. Later it clicks on the first “Allow” button, then the enable Samsung knox page will appear but it will not proceed further, as the script to automate the “Proceed” button is not written yet . 

Before running the “basics.java” class, do not forget to start the appium server with loopback IP address and adequate port number as seen in below image

Once the test script runs successfully, an indication message will appear on the IDE console and side by side the same script will run and perform the desired actions on the physical device as well.

Like many others, I also faced numerous challenges while trying to write my first automation script but the community of amazing and helpful people over the internet guided me towards the right direction. I hope this blog will encourage and help others as well to learn something new.

Leave A Comment

Your email address will not be published. Required fields are marked *