selenium webdriver - TestNG tests are not getting run when I execute testng.xml using POM file using maven-surefire -



selenium webdriver - TestNG tests are not getting run when I execute testng.xml using POM file using maven-surefire -

0 tests getting run, when execute testng.xml using pom file using maven-surefire.

i running few selenium tests using testng.xml. when run testng.xml file testng test suite, runs fine.

but, when include testng.xml file (as below) not running :

<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.14.1</version> <configuration> <suitexmlfiles> <suitexmlfile>testng.xml</suitexmlfile> </suitexmlfiles> </configuration> </plugin>

below pom file snippet:

<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>sapautomation</groupid> <artifactid>sapautomation</artifactid> <!-- <version>3.2</version> --> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>sapautomation</name> <url>http://maven.apache.org</url> <!-- javadocs --> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-eclipse-plugin</artifactid> <version>2.17</version> <configuration> <downloadsources>true</downloadsources> <downloadjavadocs>true</downloadjavadocs> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.14.1</version> <configuration> <suitexmlfiles> <suitexmlfile>testng.xml</suitexmlfile> </suitexmlfiles> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <!-- exclude unwanted bundle ex: com.sapautomation.temp etc--> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.6</version> <configuration> <excludes> <exclude>**/com/sapautomation/temp/*</exclude> </excludes> </configuration> </plugin> </plugins> </build> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <dependencies> <dependency> <groupid>info.cukes</groupid> <artifactid>cucumber-picocontainer</artifactid> <version>1.1.5</version> <scope>test</scope> </dependency> <dependency> <groupid>info.cukes</groupid> <artifactid>cucumber-junit</artifactid> <version>1.1.5</version> <scope>test</scope> </dependency> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-server</artifactid> <version>2.45.0</version> </dependency> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-firefox-driver</artifactid> <version>2.45.0</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi</artifactid> <version>3.11</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi-ooxml</artifactid> <version>3.11</version> </dependency> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-mapper-asl</artifactid> <version>1.9.2</version> </dependency> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-core-asl</artifactid> <version>1.9.2</version> </dependency> <dependency> <groupid>com.googlecode.json-simple</groupid> <artifactid>json-simple</artifactid> <version>1.1</version> </dependency> <dependency> <groupid>org.testng</groupid> <artifactid>testng</artifactid> <version>6.8.15</version> <scope>test</scope> </dependency> <dependency> <groupid>net.sourceforge.jtds</groupid> <artifactid>jtds</artifactid> <version>1.3.1</version> </dependency> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.16</version> </dependency> <dependency> <groupid>com.github.detro.ghostdriver</groupid> <artifactid>phantomjsdriver</artifactid> <version>1.0.1</version> </dependency> <dependency> <groupid>org.codeartisans.thirdparties.swing</groupid> <artifactid>org-openide-util</artifactid> <version>8.6.2</version> </dependency> <dependency> <groupid>com.oracle</groupid> <artifactid>ojdbc14-10.2.0.4.0</artifactid> <version>10.2.0.4.0</version> <scope>system</scope> <systempath>${basedir}/src/lib/ojdbc14.jar</systempath> <!-- <systempath>${java.home}/lib/ojdbc14.jar</systempath> --> </dependency> <dependency> <groupid>org.monte.screenrecorder</groupid> <artifactid>montescreenrecorder</artifactid> <version>10</version> <scope>system</scope> <systempath>${basedir}/src/lib/montescreenrecorder.jar</systempath> <!-- <systempath>${java.home}/lib/ojdbc14.jar</systempath> --> </dependency> <!-- <repositories> <repository> <id>ojdbc14</id> <url>http://www.oracle.com/technetwork/apps-tech/jdbc-10201-088211.html</url> </repository> </repositories> --> </dependencies> </project>

my testng.xml file:

<suite name="suite" parallel="tests"> <listeners> <listener class-name="com.sapautomation.listners.retrylistener"/> </listeners> <test name="test1"> <parameter name="testcaseid" value="tc1" /> <classes> <class name="com.xyz.abc.myautomationtestbyxml"/> </classes> </test> <test name="test2"> <parameter name="testcaseid" value="tc2" /> <classes> <class name="com.xyz.abc.myautomationtestbyxml"/> </classes> </test> <test name="test3"> <parameter name="testcaseid" value="tc3" /> <classes> <class name="com.xyz.abc.myautomationtestbyxml"/> </classes> </test> </suite>

test result of running pom.xml:

[info] scanning projects... [warning] [warning] problems encountered while building effective model sapautomation:sapautomation:jar:0.0.1-snapshot [warning] 'dependencies.dependency.systempath' com.oracle:ojdbc14-10.2.0.4.0:jar should not point @ files within project directory, ${basedir}/src/lib/ojdbc14.jar unresolvable dependent projects @ line 153, column 16 [warning] 'dependencies.dependency.systempath' org.monte.screenrecorder:montescreenrecorder:jar should not point @ files within project directory, ${basedir}/src/lib/montescreenrecorder.jar unresolvable dependent projects @ line 162, column 15 [warning] [warning] highly recommended prepare these problems because threaten stability of build. [warning] [warning] reason, future maven versions might no longer back upwards building such malformed projects. [warning] [info] [info] using builder org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder thread count of 1 [info] [info] ------------------------------------------------------------------------ [info] building sapautomation 0.0.1-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- maven-resources-plugin:2.6:resources (default-resources) @ sapautomation --- [info] using 'utf-8' encoding re-create filtered resources. [info] skip non existing resourcedirectory c:\automationworkspace\sapautomation\src\main\resources [info] [info] --- maven-compiler-plugin:3.3:compile (default-compile) @ sapautomation --- [info] nil compile - classes date [info] [info] --- maven-resources-plugin:2.6:testresources (default-testresources) @ sapautomation --- [info] using 'utf-8' encoding re-create filtered resources. [info] copying 1 resource [info] [info] --- maven-compiler-plugin:3.3:testcompile (default-testcompile) @ sapautomation --- [info] changes detected - recompiling module! [info] compiling 35 source files c:\automationworkspace\sapautomation\target\test-classes [info] [info] --- maven-surefire-plugin:2.14.1:test (default-test) @ sapautomation --- [info] surefire study directory: c:\automationworkspace\sapautomation\target\surefire-reports ------------------------------------------------------- t e s t s ------------------------------------------------------- running testsuite tests run: 0, failures: 0, errors: 0, skipped: 0, time elapsed: 0.496 sec results : tests run: 0, failures: 0, errors: 0, skipped: 0 [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 6.137 s [info] finished at: 2015-04-09t15:01:01+00:00 [info] final memory: 24m/277m [info] ------------------------------------------------------------------------

kindly advise.

issue still persists, after giving total path of testng.xml in pom.xml file.

<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.14.1</version> <configuration> <suitexmlfiles> <suitexmlfile>src/test/resources/testng.xml</suitexmlfile> </suitexmlfiles> </configuration> </plugin> [info] scanning projects... [warning] [warning] problems encountered while building effective model sapautomation:sapautomation:jar:0.0.1-snapshot [warning] 'dependencies.dependency.systempath' com.oracle:ojdbc14-10.2.0.4.0:jar should not point @ files within project directory, ${basedir}/src/lib/ojdbc14.jar unresolvable dependent projects @ line 154, column 16 [warning] 'dependencies.dependency.systempath' org.monte.screenrecorder:montescreenrecorder:jar should not point @ files within project directory, ${basedir}/src/lib/montescreenrecorder.jar unresolvable dependent projects @ line 163, column 15 [warning] [warning] highly recommended prepare these problems because threaten stability of build. [warning] [warning] reason, future maven versions might no longer back upwards building such malformed projects. [warning] [info] [info] using builder org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder thread count of 1 [info] [info] ------------------------------------------------------------------------ [info] building sapautomation 0.0.1-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- maven-resources-plugin:2.6:resources (default-resources) @ sapautomation --- [info] using 'utf-8' encoding re-create filtered resources. [info] skip non existing resourcedirectory c:\automationworkspace\sapautomation\src\main\resources [info] [info] --- maven-compiler-plugin:3.3:compile (default-compile) @ sapautomation --- [info] nil compile - classes date [info] [info] --- maven-resources-plugin:2.6:testresources (default-testresources) @ sapautomation --- [info] using 'utf-8' encoding re-create filtered resources. [info] copying 3 resources [info] [info] --- maven-compiler-plugin:3.3:testcompile (default-testcompile) @ sapautomation --- [info] changes detected - recompiling module! [info] compiling 35 source files c:\automationworkspace\sapautomation\target\test-classes [info] [info] --- maven-surefire-plugin:2.14.1:test (default-test) @ sapautomation --- [info] surefire study directory: c:\automationworkspace\sapautomation\target\surefire-reports ------------------------------------------------------- t e s t s ------------------------------------------------------- running testsuite tests run: 0, failures: 0, errors: 0, skipped: 0, time elapsed: 0.501 sec results : tests run: 0, failures: 0, errors: 0, skipped: 0 [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 7.402 s [info] finished at: 2015-04-14t17:31:11+00:00 [info] final memory: 22m/167m [info] ------------------------------------------------------------------------

in maven-surefire-plugin, provide total path under project testng.xml file -- example: <suitexmlfile>src/test/resources/testng.xml</suitexmlfile>

maven selenium-webdriver testng pom.xml maven-surefire-plugin

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -