cancel
Showing results for 
Search instead for 
Did you mean: 

How to print Testcase name for Failed TestSteps

Highlighted
Frequent Contributor

How to print Testcase name for Failed TestSteps

How to print Testcase name for Failed TestSteps  on Logs when running testsuite through Commandline

 

when multiple test steps failed its very hard to find which testcases are failing when i am running testsuite through commandline 

2 REPLIES 2
Occasional Contributor

Re: How to print Testcase name for Failed TestSteps

Using a groovy assert statement, anything after the colon is printed when the assertion fails.

So, in a Groovy Step (where "testRunner" is available:

String expected = "Bob" ;
String actual = "Alan" ;
assert actual == expected : testRunner.testCase.name + ": Actual does not match Expected" ;

And in a Script Assertions in a an Assertion Step (where only "context" is available):

String expected = "Bob" ;
String actual = "Alan" ;
assert actual == expected : context.testCase.name + ": Actual does not match Expected" ;

Community Hero

Re: How to print Testcase name for Failed TestSteps

New Here?
Join us and watch the welcome video:
Top Kudoed Authors