Not able to run tests for maven build successfull -1.7.2


#1

Hi guys
Following is my pom.xml i’m sure because the dependencies are not accurate my tests when running through maven is not running only it builds
Appium :1.7.2…can u guys please suggest what exact is to be added in pom.xml for appium to run through maven.have checked JAVA_HOME path edited java build compiler to jdk installed m2e eclipse plugin …kindly help my folder structure is src/main/java src/main/resources src/test/java src/test/resources…im really not able to figure it out why the tests does not run when running through maven test Eclipse->maven-> run as->maven test…its urgent please share inputs,thanks.


4.0.0
com.licious
LiciousAndroidFrame
0.0.1-SNAPSHOT
jar

LiciousAndroidFrame
http://maven.apache.org

junit junit 4.12 org.seleniumhq.selenium selenium-server 3.9.1 io.appium java-client 5.0.4 org.testng testng 6.14.2 org.apache.poi poi-ooxml 3.15 org.apache.poi poi 3.15 org.apache.poi poi-ooxml-schemas 3.15 mysql mysql-connector-java 6.0.6 org.apache.maven.plugins maven-compiler-plugin 3.7.0 1.8 1.8
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.0</version>
    <configuration>
      <systemPropertyVariables>
        <propertyName>firefox</propertyName>
      </systemPropertyVariables>
      <suitexmlfiles>
    	<suitexmlfile>test-output/testng.xml</suitexmlfile>
    </suitexmlfiles>
    </configuration>
    
  </plugin>

#2
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>3.9.1</version>
</dependency>
<dependency>
    <groupId>io.appium</groupId>
    <artifactId>java-client</artifactId>
    <version>5.0.4</version>
</dependency>
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.2</version>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.15</version>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.15</version>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml-schemas</artifactId>
    <version>3.15</version>
</dependency>
mysql mysql-connector-java 6.0.6 org.apache.maven.plugins maven-compiler-plugin 3.7.0 1.8 1.8
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.0</version>
    <configuration>
      <systemPropertyVariables>
        <propertyName>firefox</propertyName>
      </systemPropertyVariables>
      <suitexmlfiles>
    	<suitexmlfile>test-output/testng.xml</suitexmlfile>
    </suitexmlfiles>
    </configuration>
    
  </plugin>

#3

@Rathan_G
I will give it a shot… I run my tests in Maven but wrap them up into a multithreaded executable so my configuration will be different, but my pom.xml does have a surefire plugin that I dont use (see below). Im no expert here and I welcome correction/clarification but the way I understand Maven is that you use part of the POM to define what happens during the “execution phases”. What that means is when you do [mvn test] on a command line (or ask an IDE ->run maven test) the mvn execution is going to your POM to know what to do. Looking at the plugins, I think you are missing the “executions” sections of yours where the plugin is attached to the “test phase” of your maven project. Im attaching another plugin that I do use for example… When I run [mvn package], I want a jar file so I hook a maven-jar-plugin to the package phase.

            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12.4</version>
            <configuration>
                <includes>
                    <include>FooTest.java</include>
                </includes>
            </configuration>
            <executions>
                <execution>
                    <id>default-test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>Device.TestExecutions.dTestManager</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>default-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

#4

please post the error that you get.


#5

Thanks …it worked for me by adding sauce-junit dependency

<dependency>
    <groupId>com.saucelabs</groupId>
    <artifactId>sauce_junit</artifactId>
    <version>2.1.23</version>
    <scope>test</scope>
	</dependency>

hope it helps someone;)