Appium Mobile Testing and Automation: A Next Level

Sarniga A

3 min read

Welcome back to Part 2 of our Appium blog series! In Part 1, we covered the installation process and the architectural overview of Appium. If you missed Part 1, we strongly recommend you catch up before proceeding with this installment. Now, let’s continue our exploration by moving forward to the pivotal phase of setting up and configuring your test environment.

Setting up and configuring your test environment

Running the First Test on an Actual Device

Downloading and Installing the IDE(Integrated Development Environment):

To get started, you need an IDE for Java. Eclipse is a popular choice. Here’s how to install it:

  1.  Visit the Eclipse website: Go to the Eclipse downloads page at https://www.eclipse.org/downloads/
  1. Choose the Eclipse package: For Java development, you can choose “Eclipse IDE for Java Developers.” Select your operating system: On the package page, you’ll see a list of available download options for different operating systems. Click on the appropriate link for your operating system (e.g., Windows, macOS, Linux). 
  1. Download the installer: Once you click on the download link, the installer file will start downloading. The file size may vary depending on the package you selected.
  1. Run the installer: After the download is complete, locate the installer file and run it. The installer will guide you through the installation process. 

Follow the below steps to install Java into your system 

  1. Visit the official Oracle Java website: Go to the Oracle Java SE Downloads page at https://www.oracle.com/java/technologies/downloads/#java11-windows
  1. Download the installer: Click on the download link for your operating system (e.g., Windows, macOS, Linux). Choose the version that matches your system architecture (32-bit or 64-bit).
  2.  Run the installer: Once the download is complete, locate and run the installer file. 
  3. Follow the prompts provided by the installer to proceed with the installation. 
  1. Set up environment variables (optional): After the installation is complete, you may need to set up environment variables to ensure your system recognizes the Java installation. The steps for setting up environment variables can vary depending on your operating system.

Create a New Maven Project

Now that you have Eclipse and Java ready, it’s time to create a new Maven project.

  • Create a new project: Go to “File” > “New” > “Other”.
  • In the “New” dialog box, expand the “Maven” folder and select “Maven Project”. Click “Next”. 
  • Choose project template: In the “New Maven Project” dialog box, make sure Click “Next”.
  • Configure all the project details and settings 

Now you have a new Maven project set up in Eclipse. You can add dependencies to your project by editing the pom.xml file. Maven will handle dependency management and build tasks for you, making it easier to manage your project’s external libraries and build processes.

For this project add the following from the repository  https://mvnrepository.com/ 

Selenium Java

 

Appium Java

Connection of the Real Device 

Step 1: Download SDK(Software Development Kit) tools

https://developer.android.com/studio

Step 2: Unzip the folder & Extract platform tools

Step 3: Set environment variables

 ANDROID_HOME = location of SDK folder

 Path: append path of platform_tools folder

Step 4: Check command adb devices on the command line

Step 5: Make the device ready

 – enable developer mode

 – make USB Debugging on

Step 6: Connect the device to the computer system through a USB cable

 – if asked enable USB Debugging

Step 7: Run command adb devices

  adb = android debug bridge

 Check your device id displayed

Step 5: Start the Appium server

   Appium server can be started from the command line or the Appium desktop client

Step 6: Add code to start automation on the mobile device in the IDE

To derive the code and set up the base class add the desired capabilities 

Follow the below steps to inspect the mobile app using Appium inspector

To Inspect the Element Using Appium Inspector

Step 1: Start the Appium Inspector and Set the Desired Capabilities

Desired Capabilities are a set of key-value pairs that define the characteristics and behavior of the mobile device or emulator on which the tests will be executed.

{

  “platformName”: “Android”,

  “appium:platformVersion”: “8.1.0”,

  “appium:deviceName”: “emulator-5554”,

  “appium:appPackage “: “com.android.calculator2”,

  “appium:appActivity”: “com.android.calculator2.Calculator”

Step 2: Click on Start session to inspect the elements 

The session will be started with the application that needs to be inspected 

Step 3: Click on the element to Inspect and view the details of the Selected elements displayed on the screen

Step 4: Select the Id or xpath which you would like to use in the test script 

Step 5: Add the elements to the code

Step 6: Run the Script from the IDE

 Step 7: View the execution on the device

In conclusion, this blog series has provided a comprehensive introduction to Appium, guiding you through the process of creating your first test script, inspecting elements, and connecting to a real device. By now, you should have a solid understanding of how to set up Appium and harness its power to automate mobile app testing effectively. Appium is a powerful and versatile automation tool that has revolutionized mobile app testing.

Throughout this blog series, we have explored the key features of Appium, highlighting its cross-platform capabilities and support for multiple programming languages. 

I Hope this blog series assist you in taking your first step with Appium.

Happy Testing!

Related posts:

Leave a Reply

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