Problem while running testng.xml through maven profiles

1,372 views
Skip to first unread message

gopi veeramani

unread,
Apr 23, 2013, 9:10:17 AM4/23/13
to testng...@googlegroups.com
Hi guys need your help,

I have two profiles(profile-1 & profile-2) in my pom.xml file like below. If i run a profile then the test are not executed but the build is success.

To run a profile i am using this command mvn clean test -P profile-1 , i am not sure where i am making mistake whether in pom or the way i invoke profile. 

NOTE : ALL MY TEST JAVA CLASSES ARE IN src/main/java and src/test/java is simply empty.


<profiles>
<profile>
<id>profile-1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>profile-2</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<executions>
<execution>
<configuration>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/IntegrationP1.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

Krishnan Mahadevan

unread,
Apr 23, 2013, 9:29:49 AM4/23/13
to testng...@googlegroups.com
Gopi,
To begin with your question doesnt seem to be directly related to TestNG.

For Maven surefire plugin to pick up tests, I think your tests should reside in src/test/java and NOT in src/main/java.

You have also enabled the maven property : maven.test.failure.ignore



Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.           

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tomek Kaczanowski

unread,
Apr 23, 2013, 9:36:45 AM4/23/13
to testng...@googlegroups.com
hm, i think the more current docs (for maven 2/3) are here:
http://maven.apache.org/surefire/maven-surefire-plugin/

--
Regards / Pozdrawiam
Tomek Kaczanowski
http://practicalunittesting.com

gopi veeramani

unread,
Apr 24, 2013, 6:18:20 AM4/24/13
to testng...@googlegroups.com
Thanks Krishnan and Tomek.

Mohd Shahabuddin

unread,
May 22, 2014, 7:17:33 AM5/22/14
to testng...@googlegroups.com
Hi Testers,
I am also facing this issue.
Please let me know is there any progress.
Reply all
Reply to author
Forward
0 new messages