Unable to execute the testng.xml file through cmd prompt window.

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

Unable to execute the testng.xml file through cmd prompt window.

Kolusu Bindu
Hi Everyone,

I have been looking for various posts to resolve my issue, but no luck. I'm able to execute testng.xml file in eclipse IDE and it is working without any errors or classpath issues. But when I try to execute the same XML file through cmd line it is throwing below error:
 

Microsoft Windows [Version 10.0.16299.431]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\viju4>cd C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>set classpath=C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins\bin;

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>set classpath=C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins\lib\*;

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>java org.testng.TestNG testng.xml
[TestNG] [ERROR]
Cannot find class in classpath: com.vijay.jenkins.Demo
Exception in thread "main" java.lang.NullPointerException
        at org.testng.TestNG.getStatus(TestNG.java:211)
        at org.testng.TestNG.main(TestNG.java:1324)

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>

Please help me resolve this issue. And I would like to know the list of jar files should be included in the lib.jar file in the project directory.

Regards,
Bindu.

--
You received this message because you are subscribed to the Google Groups "Selenium 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c6938c4b-a832-4fc2-844f-9f8f3972fd33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to execute the testng.xml file through cmd prompt window.

Krishnan Mahadevan

Bindu,

 

This is not a Selenium question. Please help keep this forum relevant by posting queries that are ONLY related to Selenium.

 

You should be posting your query on the testng-users google forums.

 

Now to answer your question:

You are having a CLASSPATH issue. TestNG is not able to find your CLASSES. Is there any specific reason as to why you would want to run your code only via a “java “ command instead of using a build tool such as [Maven/Gradle] ? If there is no specific reason, I would suggest that you please spend sometime learning about a build tool and run your tests using the build tool. Managing the classpath is a lot more easier in those cases.

 

With respect to that NullPointerException that you are seeing, that’s a bug. I have fixed it as part of https://github.com/cbeust/testng/pull/1811

 

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/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Kolusu Bindu <[hidden email]>
Reply-To: <[hidden email]>
Date: Wednesday, June 6, 2018 at 8:14 AM
To: Selenium Users <[hidden email]>
Subject: [selenium-users] Unable to execute the testng.xml file through cmd prompt window.

 

Hi Everyone,

 

I have been looking for various posts to resolve my issue, but no luck. I'm able to execute testng.xml file in eclipse IDE and it is working without any errors or classpath issues. But when I try to execute the same XML file through cmd line it is throwing below error:

 

 

Microsoft Windows [Version 10.0.16299.431]

(c) 2017 Microsoft Corporation. All rights reserved.

 

C:\Users\viju4>cd C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>set classpath=C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins\bin;

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>set classpath=C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins\lib\*;

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>java org.testng.TestNG testng.xml

[TestNG] [ERROR]

Cannot find class in classpath: com.vijay.jenkins.Demo

Exception in thread "main" java.lang.NullPointerException

        at org.testng.TestNG.getStatus(TestNG.java:211)

        at org.testng.TestNG.main(TestNG.java:1324)

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>

 

Please help me resolve this issue. And I would like to know the list of jar files should be included in the lib.jar file in the project directory.

 

Regards,

Bindu.

--
You received this message because you are subscribed to the Google Groups "Selenium 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c6938c4b-a832-4fc2-844f-9f8f3972fd33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3241A915-8EA9-4A5E-8454-57E3D07174BA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to execute the testng.xml file through cmd prompt window.

Kolusu Bindu
Sorry for posting this issue here, I wanted to run a batch file through Jenkins. But it is throwing the same error in Jenkins too. And when i double click on the batch file i created still same error. But it is working fine in eclipse IDE, it is just executing the SysOut Statement and giving the following message in the 
command window.


C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\Jenkins>java -cp C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\Jenkins\lib\*;C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\Jenkins\bin org.testng.TestNG C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\Jenkins\demo1_testng.xml
Hi bindu

===============================================
Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

In ECLIPSE IDE:

[RemoteTestNG] detected TestNG version 6.14.2
Hi bindu 
Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 29163
Only local connections are allowed.
Jun 06, 2018 11:43:42 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
The title of the page is Facebook - Log In or Sign Up

===============================================
Suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================

kindly help to resolve this issue.

Regards,
Bindu.


On Tue, Jun 5, 2018 at 10:49 PM, Krishnan Mahadevan <[hidden email]> wrote:

Bindu,

 

This is not a Selenium question. Please help keep this forum relevant by posting queries that are ONLY related to Selenium.

 

You should be posting your query on the testng-users google forums.

 

Now to answer your question:

You are having a CLASSPATH issue. TestNG is not able to find your CLASSES. Is there any specific reason as to why you would want to run your code only via a “java “ command instead of using a build tool such as [Maven/Gradle] ? If there is no specific reason, I would suggest that you please spend sometime learning about a build tool and run your tests using the build tool. Managing the classpath is a lot more easier in those cases.

 

With respect to that NullPointerException that you are seeing, that’s a bug. I have fixed it as part of https://github.com/cbeust/testng/pull/1811

 

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/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Kolusu Bindu <[hidden email]>
Reply-To: <[hidden email]>
Date: Wednesday, June 6, 2018 at 8:14 AM
To: Selenium Users <[hidden email]>
Subject: [selenium-users] Unable to execute the testng.xml file through cmd prompt window.

 

Hi Everyone,

 

I have been looking for various posts to resolve my issue, but no luck. I'm able to execute testng.xml file in eclipse IDE and it is working without any errors or classpath issues. But when I try to execute the same XML file through cmd line it is throwing below error:

 

 

Microsoft Windows [Version 10.0.16299.431]

(c) 2017 Microsoft Corporation. All rights reserved.

 

C:\Users\viju4>cd C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>set classpath=C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins\bin;

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>set classpath=C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins\lib\*;

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>java org.testng.TestNG testng.xml

[TestNG] [ERROR]

Cannot find class in classpath: com.vijay.jenkins.Demo

Exception in thread "main" java.lang.NullPointerException

        at org.testng.TestNG.getStatus(TestNG.java:211)

        at org.testng.TestNG.main(TestNG.java:1324)

 

C:\Users\viju4\Desktop\selenium\Selenium_Scripts\FIRST_Test_Script\com.bindu.jenkins>

 

Please help me resolve this issue. And I would like to know the list of jar files should be included in the lib.jar file in the project directory.

 

Regards,

Bindu.

--
You received this message because you are subscribed to the Google Groups "Selenium 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c6938c4b-a832-4fc2-844f-9f8f3972fd33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3241A915-8EA9-4A5E-8454-57E3D07174BA%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAF3tKThQPOyd%3DsXoE6Zd6WX3rTndtmPp5DdboWLBMXNg-3B0OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.