Not able to run the project as per testng.xml with maven | Selenium Forum
M
Posted on 17/09/2015
Hi

In module 9, you have mentioned that if I have to run the testng.xml through maven then I have to to do following changes in pom.xml. So below is my pom.xml configuration

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.learntestng</groupId>
<artifactId>learntestng</artifactId>
<version>1</version>
<packaging>jar</packaging>

<name>learntestng</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

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

</dependencies>


<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>


</configuration>


</plugin>
</plugins>
</build>



</project>



I have 2 classes AppTest.java and SampleTest.java but in testng.xml , I mentioned only 1 class so that I can see that maven runs my prgram as per testng.xml

When I fired the command mvn test then it runs my both the class i.e it is not running my project as per testng.xml

Please help me in running my project as per testng.xml


Attached is my project in zip format

M
Replied on 21/09/2015

use this cmd

[code:1edde5n9]mvn clean test -U -Pselenium-tests[/code:1edde5n9]


M
Replied on 10/10/2015

Thanks ..It worked


M
Replied on 06/12/2015

Hi

Again it stopped working . Please give me the solution