paint-brush
Mobile App Test Automation - Getting Started With Appium Part 1by@josephcole
320 reads
320 reads

Mobile App Test Automation - Getting Started With Appium Part 1

by Joseph Cole-ShowersOctober 24th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Appium is an open-source, free automation testing tool for mobile. It supports cross-platform testing, meaning it can test native apps and hybrid apps. Follow this guide to get started with mobile app test automation.
featured image - Mobile App Test Automation - Getting Started With Appium Part 1
Joseph Cole-Showers HackerNoon profile picture


If you have been avoiding mobile test automation because it sounds too complex or you are unsure where to start, fear not!


When it comes to end-to-end testing for mobile apps, it can feel a lot like preparing for a trek through an unknown jungle. Whether you are looking to test an Android app or an iOS app, this guide will simplify the setup process and get you kicking with mobile app test automation.


Without wasting much time, let’s dive into it.

What is Appium?

Appium is an open-source, free automation testing tool for mobile. It supports cross-platform testing, meaning it can test native apps and hybrid apps.

Pre-requisite

Before you begin, ensure you have met the following requirements:


  • Download and Install the latest version of nodejs from the official site here
  • Download and Install Java Development Kit (JDK) from the official site here
  • XCode Installed
  • Android Studio Installed


N/B: To verify you have installed node, in your terminal, write node -v which will tell you the current version installed.

Installing Appium

  • Open your terminal, and write this command npm install -g [email protected] to install Appium.
  • In your terminal write this command appium driver install [email protected] to install the UI Automator driver.
  • In your terminal write this command appium driver install [email protected] to install the XCUITest driver.
  • In your terminal write this command appium plugin install --source=npm [email protected] to install a wait plugin.
  • Download, and install Appium Inspector from here.


That’s it! You are good to go.


To run Appium, simply write appium in your terminal, and the server loads up.


Appium Server


Getting Started

Now that we have installed Appium, we can now write test scripts to test mobile apps. But before we can write any code, we need an IDE. An IDE is a code editor that allows us to write scripts to test and build software.


There are many IDEs out there, but for a quick start, we will be using IntelliJ IDE. You can download and install IntelliJ IDE here. You can make use of the community version.


Once you have downloaded and installed IntelliJ IDE, open the software.


IntelliJ IDE


Create a New Project on IntelliJ

  • Click on new project.

  • Ensure that “Java” is selected as shown below.

  • Give the project a name.

  • Select the build as Maven.

  • Select the JDK installed or registered when you click the drop-down.

  • Once you are done, click on the Create button.



Creating a New Project on IntelliJ


You will be provided with a pom.xml file. Now, the pom.xml file is going to contain the necessary dependencies we need to use to run Appium.


Open the pom.xml file, and add the following dependencies:


<dependencies>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>7.13.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.9.0</version>
            <scope>test</scope>
        </dependency>

    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.6.0</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>4.24.0</version>
    </dependency>
</dependencies>


Once you add the dependencies above in the pom.xml file, an “m” button may pop up by the top right corner, click on it so that it installs the dependencies.

Conclusion

So far, we have installed Appium with the related drivers and plugins we need to be able to successfully run Appium on our machine. We have also installed a code editor - IntelliJ. Finally, we have been able to create a new project on add dependencies in the pom.xml file.