How to get full test output when running tests from command line

120 views
Skip to first unread message

Jay U

unread,
Sep 4, 2015, 9:02:53 PM9/4/15
to testng-users
Hey there,

I'm running Webdriver test suites with TestNG (version 6.8). I can successfully launch the test suite from within Eclipse or from the command line, and the suite completes. When I run the suite in Eclipse, the output in the Console tab of Eclipse ends with the following summary. Note that this output has the failing method and an except of the stack trace (very helpful).


PASSED: testFoo_1
PASSED
: testFoo_2
...
FAILED
: testFoo_74
org
.openqa.selenium.StaleElementReferenceException: Element not found in the cache - perhaps the page has changed since it was looked up
Command duration or timeout: 5 milliseconds


===============================================
Web Driver Tests PROD_customer
Total tests run: 74, Failures: 1, Skips: 0
===============================================


When I launch the test suite from the command line, the output to terminal does not have the list of methods (pass or fail) and no stack traces. Example:

===============================================
Web Driver Tests PROD_customer
Total tests run: 74, Failures: 1, Skips: 0
===============================================


I reviewed this answer but that topic addresses a more complex requirement. I'm trying to do something far simpler and I'm hoping there's a config setting that I'm missing.

Any help or suggestions gratefully acccepted!

Thank you,
Jay

Krishnan Mahadevan

unread,
Sep 7, 2015, 11:00:27 AM9/7/15
to testng...@googlegroups.com
When you say  
>>>>>> When I launch the test suite from the command line, the output to terminal does not have the list of methods (pass or fail) and no stack traces. Example:

What exactly do you mean ? Can you show us how are you executing your test methods ? Is via a build tool such as Maven/ANT/Gradle or are you using the java command to trigger your tests ?

If its via a build tool and if there is a TestNG XML Suite file involved, then try setting the verbose attribute to a value of 2 (or) above and you should see whatever you are expecting.


If you are using "java" command to run your tests , then you can the argument "-verbose". [ https://github.com/cbeust/testng/blob/master/src/main/java/org/testng/CommandLineArgs.java#L18 ]











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/

--
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.
For more options, visit https://groups.google.com/d/optout.

Jay U

unread,
Sep 9, 2015, 12:03:11 AM9/9/15
to testng-users
Success!! Thanks so much, Krishnan. I'm running this in a Docker container so I'm using the java -cp command.

java -cp testng-6.8.jar:test-ui.jar org.testng.TestNG webDriverSuitePROD_customer1.xml -verbose 10

Not sure whether we'll be able to add this to a gradle task, but maybe...

Many thanks also for the reference to the CommandLineArgs. Highly desirable...and not illegal, expensive, fattening, or in love with someone else ;)

Thanks again, this saved me so much time.

-Jay
Reply all
Reply to author
Forward
0 new messages