user2909951 user2909951 - 2 months ago 18
Java Question

How to get full AssertionError report without removing the Stack Frame in TestNG?

I use Selenium with TestNG.

I got following exception, when trying to get a element using

Assert.fail();


The need is, I want to get the full stack frames. In the exception the removed stack frames ("Removed 24 stack frames") printed at the bottom of the exception.
But I want to print all the stack frames in the report.

java.lang.AssertionError: Elements[id, newDocName] was Not Visible
after waiting for 1 Minute

at processor.WebdriverActions.writeFailure(WebdriverActions.java:2213)

at
processor.WebdriverActions.waitForElementVisible(WebdriverActions.java:1015)

at
testcases.NewUI_Animation_All.TC001_PresentationCreation_ChooseTheme(NewUI_Animation_All.java:12)

... Removed 24 stack frames


Thanks in Advance.

Answer

You didn't describe how you run your tests, but if you want the complete Stacktrace, you can:

  • Use system property: -Dtestng.show.stack.frames=true JVM option or System.setProperty("testng.show.stack.frames", "true") in your code
  • Configure an higher verbose level (full stacktrace starts with verbose>=2)
Comments