Appium Maven Dependency: Installation with Project Example

What is Apache Maven?

Apache Maven is a Java-based project management and automation tool. It provides a multitasking framework for developers to ease the complete build lifecycle for Java applications. Maven is pre-defined and declared in an XML format called POM (Project Object Model) and referred to as ‘pom.xml.’ It can also be used for other languages like C#, Scala, Ruby, etc.

Using Maven framework, we can easily manage following tasks in any project-

  • Build cycle
  • Project Documentation
  • Report Checks
  • Scrums management
  • Release Information

Basic uses of Maven are-

  • Enforces a standard directory structure.
  • Provide a reusable and easy to maintain project structure.
  • Resolve packages dependencies.
  • Provide a configuration management framework.

Download Appium Maven Dependencies

Before start writing APPIUM dependency test with Maven, we need to download Appium Maven dependency from Appium JAR download file from Maven central repository website.

Download Appium Maven Dependencies

or directly add below mentioned POM.xml artifact:

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

Please go through our Maven tutorial to learn how to configure Maven with Eclipse.

Testing Application with APPIUM and Maven

After configuring Appium Java Maven plug-in Eclipse. It will be ready to test any android .apk application with Appium and Maven as shown in the Appium Maven project example below.

Step 1) In this step,

  1. Go to NEW >> select Maven project
  2. Click on ‘next’ button

Testing Application with APPIUM and Maven

Step 2) Then in ‘New Maven Project’ window, enter ‘Appium Test’ in Group Id and Artifact Id column. In this step, you have to enter.

  1. Group Id
  2. Artifact Id
  3. Version
  4. Packaging
  5. Name and Description
  6. Finish

Testing Application with APPIUM and Maven

Clicking on Finish button. It will open a new class on the defined Group Id (AppiumTest) name.

Step 3) To start with Appium script. Right click on ‘src/main/java’ from left side explorer window. Then select New >> class. Write the Appium code inside the selected class.

How to Test Application with APPIUM and Maven

Step 4) In the same project, click over pom.xml from left explorer menu. All dependencies will be visible by default in ‘pom.xml’ tab. Refer to the Image below-

How to Test Application with APPIUM and Maven

If in the case of default pom.xml does not exist then just add all Maven Appium dependencies. (extracted from Maven central repository website}

http://search.maven.org/#search|gav|1|g%3A%22io.appium%22%20AND%20a%3A%22java-client%22

Steps to Test Application with APPIUM and Maven

Step 5) Now, right click on ‘pom.xml’ from left explorer or over the xml code for ‘AppiumTest’ project. Then click ‘Run As >> Maven Clean’ option.

Steps to Test Application with APPIUM and Maven

While running, the user could see all Maven related jar files and success message. Hence, this way the user can run APPIUM Java client Maven dependency test with Maven configured environment.

Testing an Application with APPIUM and Maven

Summary:

  • Maven is a JAVA based Project Management Framework.
  • It is pre-defined and declared in XML format called as POM (Project Object Model) and referred to ‘pom.xml’.