[TestNG] No tests found. Nothing was run -- When tests are run from a testJar

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[TestNG] No tests found. Nothing was run -- When tests are run from a testJar

Musaffir Lp
Hello,

I have a maven project and I use testNg of version 6.13.1
[ The project is mainly to execute my selenium tests and I also have reportNg plugin configured in the pom.xml file not sure this plugin causing any prob here, hence mentioning here ]...

I am able to invoke mvn package command ...and it makes the test jar during its build cycle as expected fine ...I verified that the test jar contains the test class ...

I wanted to utilize this test jar for some of my other purposes and hence wanted to run from commandline by passing the path of suite xml file which is also present in the root path of jar......

I invoke from the coomandline as
java -cp MyTestJar.jar;lib/* org.testng.TestNG -testjar MyTestJar.jar -xmlpathinjar MyTestSuite.xml

lib/* - contains all the dependencies

but when this runs , the testNG is getting invoked, I could see it is considering correct suite xml file etc...but always giving me in return as below
[TestNG] No tests found. Nothing was run 


I could not figure out what is causing this .... I understand this message is purposefully added in testNG..
...
... TestNG 6.13.1 by Cédric Beust ([hidden email])
...

===== Invoked methods
=====

===============================================
    My Test Name
    Tests run: 0, Failures: 0, Skips: 0
===============================================


===============================================
My Suite name
Total tests run: 0, Failures: 0, Skips: 0
===============================================

[TestNG] No tests found. Nothing was run
Usage: <main class> [options] The XML suite files to run
  Options:


Bit more info:
From the main maven project , I can use maven sure-fire plugin to execute the tests which is working fine .
In the maven build cycle it self I am making the test jar with below plugin
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I make all dependencies to be stored in lib with
<plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <version>3.0.2</version>
                            <executions>
                                <execution>
                                    <id>copy-dependencies</id>
                                    <phase>prepare-package</phase>
                                    <goals>
                                        <goal>copy-dependencies</goal>
                                    </goals>
                                    <configuration>
                                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                        <overWriteReleases>false</overWriteReleases>
                                        <overWriteSnapshots>false</overWriteSnapshots>
                                        <overWriteIfNewer>true</overWriteIfNewer>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>



Couldn't figure out it my own. Please let me know if you have any leads to the solution

Many Thanks
Musaffir

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [TestNG] No tests found. Nothing was run -- When tests are run from a testJar

Mallikarjuna Rao
Hi Musaffir , if there is any error in Listeners , you will end up such situation. Please check for any exceptions in Listener code.

Malli

On Tuesday, 16 January 2018 10:53:57 UTC+5:30, Musaffir lp wrote:
Hello,

I have a maven project and I use testNg of version 6.13.1
[ The project is mainly to execute my selenium tests and I also have reportNg plugin configured in the pom.xml file not sure this plugin causing any prob here, hence mentioning here ]...

I am able to invoke mvn package command ...and it makes the test jar during its build cycle as expected fine ...I verified that the test jar contains the test class ...

I wanted to utilize this test jar for some of my other purposes and hence wanted to run from commandline by passing the path of suite xml file which is also present in the root path of jar......

I invoke from the coomandline as
java -cp MyTestJar.jar;lib/* org.testng.TestNG -testjar MyTestJar.jar -xmlpathinjar MyTestSuite.xml

lib/* - contains all the dependencies

but when this runs , the testNG is getting invoked, I could see it is considering correct suite xml file etc...but always giving me in return as below
[TestNG] No tests found. Nothing was run 


I could not figure out what is causing this .... I understand this message is purposefully added in testNG..
...
... TestNG 6.13.1 by Cédric Beust (<a onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;" href="javascript:" target="_blank" rel="nofollow" gdf-obfuscated-mailto="3Qb0-2urDwAJ">ced...@...)
...

===== Invoked methods
=====

===============================================
    My Test Name
    Tests run: 0, Failures: 0, Skips: 0
===============================================


===============================================
My Suite name
Total tests run: 0, Failures: 0, Skips: 0
===============================================

[TestNG] No tests found. Nothing was run
Usage: <main class> [options] The XML suite files to run
  Options:


Bit more info:
From the main maven project , I can use maven sure-fire plugin to execute the tests which is working fine .
In the maven build cycle it self I am making the test jar with below plugin
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I make all dependencies to be stored in lib with
<plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <version>3.0.2</version>
                            <executions>
                                <execution>
                                    <id>copy-dependencies</id>
                                    <phase>prepare-package</phase>
                                    <goals>
                                        <goal>copy-dependencies</goal>
                                    </goals>
                                    <configuration>
                                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                        <overWriteReleases>false</overWriteReleases>
                                        <overWriteSnapshots>false</overWriteSnapshots>
                                        <overWriteIfNewer>true</overWriteIfNewer>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>



Couldn't figure out it my own. Please let me know if you have any leads to the solution

Many Thanks
Musaffir

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [TestNG] No tests found. Nothing was run -- When tests are run from a testJar

Musaffir Lp
In reply to this post by Musaffir Lp
Thanks Malli for checking this
I have figured out it
The reportNG plugin was causing the issue here
It was configured  as
        <dependency>
           
<groupId>org.uncommons</groupId>
           
<artifactId>reportng</artifactId>
           
<version>1.1.2</version>
           
<scope>test<scope>  
           
<exclusions>
               
<exclusion>
                   
<groupId>org.testng</groupId>
                   
<artifactId>testng</artifactId>
               
</exclusion>
           
</exclusions>
       
</dependency>

Removing  <scope>test<scope> resolved the issue
I think its maven dependency issue when used testng seperately and used reportNg
I will update this forum with more explanation soon on this once i give some more study abt it ...hope it will be useful for future readers...

Thanks


On Tuesday, January 16, 2018 at 1:23:57 PM UTC+8, Musaffir lp wrote:
Hello,

I have a maven project and I use testNg of version 6.13.1
[ The project is mainly to execute my selenium tests and I also have reportNg plugin configured in the pom.xml file not sure this plugin causing any prob here, hence mentioning here ]...

I am able to invoke mvn package command ...and it makes the test jar during its build cycle as expected fine ...I verified that the test jar contains the test class ...

I wanted to utilize this test jar for some of my other purposes and hence wanted to run from commandline by passing the path of suite xml file which is also present in the root path of jar......

I invoke from the coomandline as
java -cp MyTestJar.jar;lib/* org.testng.TestNG -testjar MyTestJar.jar -xmlpathinjar MyTestSuite.xml

lib/* - contains all the dependencies

but when this runs , the testNG is getting invoked, I could see it is considering correct suite xml file etc...but always giving me in return as below
[TestNG] No tests found. Nothing was run 


I could not figure out what is causing this .... I understand this message is purposefully added in testNG..
...
... TestNG 6.13.1 by Cédric Beust ([hidden email])
...

===== Invoked methods
=====

===============================================
    My Test Name
    Tests run: 0, Failures: 0, Skips: 0
===============================================


===============================================
My Suite name
Total tests run: 0, Failures: 0, Skips: 0
===============================================

[TestNG] No tests found. Nothing was run
Usage: <main class> [options] The XML suite files to run
  Options:


Bit more info:
From the main maven project , I can use maven sure-fire plugin to execute the tests which is working fine .
In the maven build cycle it self I am making the test jar with below plugin
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I make all dependencies to be stored in lib with
<plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <version>3.0.2</version>
                            <executions>
                                <execution>
                                    <id>copy-dependencies</id>
                                    <phase>prepare-package</phase>
                                    <goals>
                                        <goal>copy-dependencies</goal>
                                    </goals>
                                    <configuration>
                                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                        <overWriteReleases>false</overWriteReleases>
                                        <overWriteSnapshots>false</overWriteSnapshots>
                                        <overWriteIfNewer>true</overWriteIfNewer>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>



Couldn't figure out it my own. Please let me know if you have any leads to the solution

Many Thanks
Musaffir

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.