You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by vishwa <vi...@ca.com> on 2013/07/12 08:36:21 UTC
Unable to run a particular test group in testng
Hi Members,
I am very new to this forum. I am trying to run a particular group of tests
from testng.
I have to groups of tests: *first* and *second*.
*testng.xml:
----------*
/<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite 1">
<test name="testNG test1">
<classes>
<class name="com.prac1.MyFirstTest"/>
</classes>
<groups>
<run>
<include name="first"/>
</run>
</groups>
</test>
</suite>
/
*pom.xml:
--------*
/<?xml version="1.0" encoding="UTF-8"?>
<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>vnath</groupId>
<artifactId>Student</artifactId>
<version>2.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugin</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<testSourceDirectory>src/test/java</testSourceDirectory>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${basedir}/src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>/
*Project structure:
----------------*
Student
|
|---src
| |---main
| | |----java
| | | |--com
| | | |--prac
| | | |--Student.java
| | |----resources
| |
| |
| |---test
| |---java
| | |---com
| | |---prac1
| | |---MyFirstTest.java
| |
| |---resources
| |---testng.xml
|
|----pom.xml
When I ran *mvn test* command, It executed all the test groups but I am
expecting only "first" test group tests to be run.
What is the problem in the above pom.xml or testng.xml?
Please help me.
Thanks in advance,
Vishwanath
--
View this message in context: http://maven.40175.n5.nabble.com/Unable-to-run-a-particular-test-group-in-testng-tp5762745.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Unable to run a particular test group in testng
Posted by Andreas Gudian <an...@gmail.com>.
Am Freitag, 12. Juli 2013 schrieb vishwa :
> Hi Andreas,
> Thanks for the quick reply. Replaced 2.5.1 with 2.15 and tried but I got
> some errors:
> /[ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:2.15 or one
> of its
> dependencies could not be resolved: Failed to read artifact descriptor for
> org.
> apache.maven.plugins:maven-compiler-plugin:jar:2.15: Could not find
> artifact
> org
> .apache.maven.plugins:maven-compiler-plugin:pom:2.15 in central
> (http://repo.mav
> en.apache.org/maven2) -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> swit
> ch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please
> rea
> d the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
> onException/
>
> Thanks,
> Vishwanath
Leave the compiler-plugin version as it was. The different plugins are
versioned and released separately.
Re: Unable to run a particular test group in testng
Posted by vishwa <vi...@ca.com>.
Hi Andreas,
Thanks for the quick reply. Replaced 2.5.1 with 2.15 and tried but I got
some errors:
/[ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:2.15 or one
of its
dependencies could not be resolved: Failed to read artifact descriptor for
org.
apache.maven.plugins:maven-compiler-plugin:jar:2.15: Could not find artifact
org
.apache.maven.plugins:maven-compiler-plugin:pom:2.15 in central
(http://repo.mav
en.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
rea
d the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException/
Thanks,
Vishwanath
--
View this message in context: http://maven.40175.n5.nabble.com/Unable-to-run-a-particular-test-group-in-testng-tp5762745p5762752.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Unable to run a particular test group in testng
Posted by Andreas Gudian <an...@gmail.com>.
Am Freitag, 12. Juli 2013 schrieb vishwa :
> Hi Members,
> I am very new to this forum. I am trying to run a particular group of tests
> from testng.
> I have to groups of tests: *first* and *second*.
>
> *testng.xml:
> ----------*
> /<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
> <suite name="Suite 1">
> <test name="testNG test1">
> <classes>
> <class name="com.prac1.MyFirstTest"/>
> </classes>
> <groups>
> <run>
> <include name="first"/>
> </run>
> </groups>
> </test>
> </suite>
> /
> *pom.xml:
> --------*
> /<?xml version="1.0" encoding="UTF-8"?>
> <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>vnath</groupId>
> <artifactId>Student</artifactId>
> <version>2.0</version>
> <properties>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> </properties>
>
> <dependencies>
> <dependency>
> <groupId>org.testng</groupId>
> <artifactId>testng</artifactId>
> <version>6.8</version>
>
> </dependency>
> </dependencies>
>
> <build>
> <testResources>
> <testResource>
> <directory>src/test/resources</directory>
> </testResource>
> </testResources>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugin</groupId>
>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.5.1</version>
> <configuration>
>
> <testSourceDirectory>src/test/java</testSourceDirectory>
> <suiteXmlFiles>
>
> <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
> </suiteXmlFiles>
> </configuration>
> </plugin>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.5.1</version>
> <configuration>
> <suiteXmlFiles>
>
> <suiteXmlFile>${basedir}/src/test/resources/testng.xml</suiteXmlFile>
> </suiteXmlFiles>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>/
>
> *Project structure:
> ----------------*
>
> Student
> |
> |---src
> | |---main
> | | |----java
> | | | |--com
> | | | |--prac
> | | | |--Student.java
> | | |----resources
> | |
> | |
> | |---test
> | |---java
> | | |---com
> | | |---prac1
> | | |---MyFirstTest.java
> | |
> | |---resources
> | |---testng.xml
> |
> |----pom.xml
>
>
>
> When I ran *mvn test* command, It executed all the test groups but I am
> expecting only "first" test group tests to be run.
>
> What is the problem in the above pom.xml or testng.xml?
>
> Please help me.
>
> Thanks in advance,
> Vishwanath
>
Hi,
Please try again with surefire version 2.15 (it is the latest release).
Andreas