The Ultimate Guide to Mastering Mobile App Testing with Appium: A Step-by-Step Guide to Setting Up Appium

Automation testing, including tools like Appium, is indispensable in modern software development for its ability to enhance efficiency, consistency, and scalability in mobile application testing.



Appium stands out as a favored choice due to its cross-platform compatibility, open-source nature, support for multiple programming languages, and seamless integration with testing frameworks, empowering organizations to ensure the quality and reliability of their mobile apps across diverse devices and platforms. This documentation provides a step-by-step guide on how to test Android App using Appium.

Contents

Prerequisites

Before you begin setting up Appium, make sure you have the following prerequisites in place:

  • Node.js and npm: Appium is built on Node.js, so you need to have Node.js installed.
  • Java Development Kit (JDK): Install the latest version from Oracle's website if you plan to automate Android apps.
  • Android Studio: Required for the Android Virtual Device (AVD) emulator if you plan to automate Android apps.
  • Eclipse IDE: You can use Eclipse for your automation projects.
  • TestNG Plugin for Eclipse: Install the TestNG plugin for Eclipse to facilitate test case management.
  • APK Info app: Install the APK Info app from the Google Play Store for Android automation.
  • ADB (Android Debug Bridge): ADB is a command-line tool that comes with Android Studio. Make sure it's installed and added to your system's PATH.

How to Install Appium Server

Appium is an open-source tool that enables automated testing of mobile applications on Android and iOS platforms.

Install Appium Server

You can install Appium using the GUI Appium Server or through the command line:

  1. Using GUI Appium Server (Recommended for beginners)

    1. Download the GUI Appium Server from the official releases page.
    2. Choose the appropriate version for your operating system (Windows, macOS, or Linux) and download it.
    3. Install Appium by following the installation instructions for your specific operating system.
    4. Launch the Appium GUI. You will use this interface to configure and run your Appium tests.
  2. Through Command Line

    1. Install Node.js and npm from the official website.
    2. To verify that Node.js and npm are installed correctly, open your command line or terminal and run the following commands:
      node -v
    3. Install Appium globally by running the following command:
      npm install -g appium
    4. Start the Appium Server by running:
      appium
      This command will start the Appium Server, and it will display the server's IP address and port, which you will use to connect your automation scripts.

Steps to Download, Install, and Set Up Eclipse IDE:

  1. Download Eclipse IDE:

    • Visit the official Eclipse download page at https://www.eclipse.org/downloads/.
    • Choose the Eclipse IDE flavor that matches your development requirements.
    • Click on the download link corresponding to your operating system (Windows, macOS, or Linux).
  2. Direct Package Installation (Alternative):

    • If you downloaded a package directly (e.g., a .zip or .tar.gz file), extract it to your desired installation directory.
  3. Launch Eclipse IDE:

    • After installation, navigate to the Eclipse installation directory and launch Eclipse by executing the appropriate executable file for your operating system.
  4. Select a Workspace:

    • The first time you launch Eclipse, it will prompt you to select a workspace directory. This is where your projects and configuration settings will be stored. You can choose the default workspace or specify a custom location.
  5. Install TestNG Plugins (Optional):

    1. Access the Eclipse Marketplace:

      Click on the "Help" menu in the top menu bar of Eclipse, and then select "Eclipse Marketplace." This will open the Eclipse Marketplace window.

    2. Search for TestNG:

      In the Eclipse Marketplace window, you'll find a search bar at the top-right corner. Type "TestNG" into the search bar and press Enter.

    3. Locate the TestNG Plugin:

      The search results will display the TestNG plugin. Click on it to select it.

    4. Install TestNG:

      Click the "Install" button next to the TestNG plugin in the search results.

    5. Review and Confirm:

      Eclipse will present you with an installation summary, showing you the features and components that will be installed. Review this information and click the "Confirm" or "Next" button.

    6. Accept the License Agreement:

      You will be prompted to accept the terms of the TestNG license agreement. Check the box to accept the license agreement, and then click "Finish" to proceed.

    7. Restart Eclipse:

      After the installation is complete, Eclipse will prompt you to restart the IDE. Click the "Restart Now" button to restart Eclipse.

APK Info App

The APK Info app is a handy utility that allows users to retrieve detailed information about Android application packages (APKs). It provides essential insights into an APK's properties, permissions, version details, and more. For testing, we require information like Package name, version name, Minimum Android Version, etc. You can install this app from the Google Play Store and explore APK details.

Create a Simple Maven Java Project:

  1. Open Eclipse IDE and make sure it's configured properly.
  2. Go to File > New > Other and select Maven > Maven Project.
  3. Click "Next" and choose the option "Create a simple project (skip archetype selection)."
  4. Click "Next" and enter your project details (Group Id and Artifact Id).
  5. Click "Finish" to create the Maven project.

Add Dependencies to pom.xml (Appium, Selenium, TestNG)

In your newly created Maven project, locate the pom.xml file. Open the pom.xml file in Eclipse. Inside the <dependencies> section, add the necessary dependencies for Appium, Selenium, and TestNG. Here's an example:

<dependencies>

    <!-- Appium -->

    <dependency>

        <groupId>io.appium</groupId>

        <artifactId>java-client</artifactId>

        <version>7.5.1</version> <!-- Use the latest version available -->

    </dependency>

    <!-- Selenium -->

    <dependency>

        <groupId>org.seleniumhq.selenium</groupId>

        <artifactId>selenium-java</artifactId>

        <version>3.141.59</version> <!-- Use the latest version available -->

    </dependency>

    <!-- TestNG -->

    <dependency>

        <groupId>org.testng</groupId>

        <artifactId>testng</artifactId>

        <version>7.4.0</version> <!-- Use the latest version available -->

    </dependency>

</dependencies>

Save the pom.xml file, and Eclipse will automatically download the dependencies.

Connect ADB and Mobile Device via USB

Ensure that your Android device is connected to your computer via USB, and USB debugging is enabled on your Android device.

Start the Appium Server

If you haven't already, start the Appium Server using either the GUI Appium Server or the command-line approach, as explained in the previous sections.

Run Your Java TestNG Test

Right-click on your test class (e.g., AndroidAppTest) in Eclipse. Select Run As > TestNG Test. Eclipse will execute your Appium test, and you'll see the test results in the TestNG output.

Conclusion

Setting up Appium for mobile application testing is a crucial step in ensuring the quality and reliability of your mobile apps. With the right prerequisites and steps, you can automate your testing process efficiently. Now that you have a step-by-step guide, you're ready to embark on your Appium testing journey.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.