Running Appium tests from command line Jenkins/Maven

I am writing my Test Cases using the TestNG framework. I want to be able to run it through Eclipse and through the terminalon my local, but eventually I want to be able to run these tests through a Jenkins job automatically. I am very confused as to whether I need to use/install Maven for this purpose (also in Eclipse if I need to create java or maven project). To be able to use jenkins or terminal do I really need to use Maven? I did some research and I think Jenkins could run it without maven? But still I see lot of ppl using maven to run tests from command line. So please let me know if maven is required to run these from the command line, and eventually from the jenkins.
If the answer is yes can someone please jot down the steps of what I would need (starting from creating a maven project). Would be GREATLY appreciated.

@RamS @sunflower0609 or anyone please. Thanks.

can someone please respond to this? would appreciate it thanks!

@brentlavelle @Mario please ?

example run with some variables to report results into testRail:

mvn test -DsuiteFile=src/test/java/resources/testIOSLocal.xml -DtestRailEnable=true -DtestRailPlanID=137 -DtestRailRunID=106

Hi @Styris,

I would consider using a build file to start your tests and manage your dependencies. Maven do a good job of this. Check out the doc here
Have fun.


@amedvedev not sure - can you please elaborate?

so to start off (and sorry if I sound stupid)

  • in Eclipse do I need to create a Maven project or a JAVA Project? I could still use the TestNG framework right?
  • I have Maven installed in Ecllipse but does anything else need to be done for Maven on my MAC ? plus any Env. variables ?
  • I eventually have to run this from a Jenkins box which will need to be synced up with the repo on GitHub so for the file path any example of what I need to put in there for the capabilities ?
  • From the terminal/Jenkins how will I be able to incorporate Maven/TestNG.xml file/surefire ?

I don’t know if all of this info is out there somewhere that is what I critically need. Thanks!

first install maven on your machine.
then add pom.xml file to your project ( - if you do not have it yet.
finally run your testNG.

Create maven project in eclipse
Add Appium , Selenium dependancy
Add Test in TestNG test
Create TestNG xml file
Call XML file in POM.xml

Add command mvn test in jenkins.

@amedvedev @Mario @Arvind_Patel
I have a question that I am hoping you can please help answer.

  1. With my Maven project for Appium/Selenium (using Cucumber/JAVA) at the end of running the tests I am looking for a report that lists details such as total no. of TCs, passed/failed/not run etc. However all I am getting is a listing of all the features marked in red or green with some stracktrace for the failed ones. I am pasting a snippet from my POM.xml file here for anyone to suggest what addition/edit I need to make to get the desired results. Please let me know if you have any questions that can help you assess this better.
    cukereport.txt (3.7 KB)
  2. If I need to only run certain tests and skip certain (sometimes I will run only some…and other times some other tests as part of regression). What is the way to do that please. I know I may need to use tags but how can I then run them via command line/CucumerbRunnerClass (currently I run my tests by typing ‘mvn test’ in the Project directory).

Thanks in advance!

give us your pom.xml

Hi @Aleksei
it is attached in the message above…here it is again though.

Thankscukereport.txt (3.7 KB)

you can do this via properties.

in pom.xml:

1 add:

    <!-- Test Suites -->
    <!-- Default Test Suite files if not being specified from mvn command line -->

2 start any test.xml file like 'mvn test -DsuiteFile=“src/test/java/resources/someOtherTestSuite.xml”

inside ‘someOtherTestSuite.xml’ you may mention whatever tests need to be run.

@Aleksei is this for TestNG or Cucumber framework?

Also the mvn command 'mvn test -DsuiteFile=“src/test/java/resources/someOtherTestSuite.xml” is for running but what if I want to skip some test

we use testNG.

forgotten to mention to add into pom.xml:

            <!-- Suite file injection parameter from command line -->

inside XML file you prepare needed set of tests e.g.:

<!DOCTYPE suite SYSTEM "" >
<suite name="Android_Regression">
    <test name="Set_1" preserve-order="true">
            <class name=""/>
            <class name=""/>