Forum Discussion

DLIVELY's avatar
Occasional Visitor
3 years ago

Finding any failed test steps using groovy

Hello all -- 

I have a test suite with a number of steps which all work together in a flow.  Some are groovy steps, some are REST, etc.  At the end of the flow, during the teardown script, I write the status and various bits of information to a DB for tracking / other uses.  I am trying to find a way to look at "all" of the test steps in any given flow, and report on which one (or maybe potentially ones) failed.  I know I can look for any named test step and get that information, if I look for something specific.  


Is there any way to get the name of any step that fails, without specifically calling out the name of that step?  The idea is to add which step failed to the DB so when I see a failure I already know exactly which step failed vs just seeing the test case itself failed - then having to go rerun the test to find  the issue.  (Most test cases are kicked off using a runner test case with either a groovy script kicking off tests in other projects, or a run test case step kicking off local tests.)  If I can use some generic approach to find the failed step names, then I do not need to write it out for every step in every test case that we execute.  I would like to basically add a statement in the tear down (or even a groovy script at the end of the flow) to all of the test cases that just looks at the test steps and returns the name of any that failed.  I hope that makes sense.

No RepliesBe the first to reply