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.
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.
Before you begin, ensure you have met the following requirements:
N/B: To verify you have installed node, in your terminal, write node -v
which will tell you the current version installed.
npm install -g [email protected]
to install Appium.appium driver install [email protected]
to install the UI Automator driver.appium driver install [email protected]
to install the XCUITest driver.appium plugin install --source=npm [email protected]
to install a wait plugin.That’s it! You are good to go.
To run Appium, simply write appium
in your terminal, and the server loads up.
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.
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.
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.
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.