Ask a Question

How to print Testcase name for Failed TestSteps

678
Regular 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
CharlesHarold
Occasional Contributor

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" ;

nmrao
Champion Level 2

cancel
Showing results for 
Search instead for 
Did you mean: