Tech Blog

Testing

Make A Start With Appium

By Sangam Gandhi3 min read
← Back to blog

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.

Keep reading

You may be interested in

Browse all articles →
Software Testing: Challenges and Solutions
February 8, 20244 min read

Software Testing: Challenges and Solutions

Introduction – Testing software is a crucial aspect of the development process. It makes sure that the product’s functionality works as expected, fulfills the user requirements, and makes sure it works without errors. In this blog, we will list down some of the most common challenges faced in software testing and conclude with how to […]

By Saboor ChandshahaRead More →
Streamlining Software Quality: The Power of Automating Black Box Testing
February 8, 20244 min read

Streamlining Software Quality: The Power of Automating Black Box Testing

Introduction :  In the dynamic realm of software development, ensuring the robustness and reliability of applications is of paramount importance. Black box testing, a technique that assesses software functionality without requiring knowledge of its internal code, plays a vital role in identifying potential defects. As the complexity of software systems continues to escalate, the manual […]

By Anthony Gilchrist G SRead More →
Implementing best practices for end-to-end testing in cloud migration
January 31, 20245 min read

Implementing best practices for end-to-end testing in cloud migration

Importance of End-to-End Testing Assume an organization’s core systems are now hosted on the cloud—a complex ecosystem linked by data threads. End-to-end testing is the foundation upon which the reliability and performance of this interconnected web is built. This rigorous testing technique makes it possible to detect vulnerabilities, optimize operations, and improve user experience. Active […]

By Rahul ChakravartiRead More →