Is there a way to take screenshots when an assertion fails?

I want to be able to verify the presence of an image in a script but I don’t want the failure to stop the script execution. My code looks like the following:

set the assertionBehavior to “warning”

BeginTestCase “verify image x exists”
Assert that ImageFound(5, “imageX”)
EndTestCase “verify image x exists”

Is there a way to capture a screenshot only if the assertion fails? What is the proper way to do this?

Hi,

There’s currently no way to do this, but we consider it an interesting and valid feature request, so we’ll look at adding this as an option for a future release.

You could just use a conditional test rather than an assertion and then capture the screenshot if the condition is false.

Thanks Matt. For now, I plan to add a conditional statement before every assertion that captures a screenshot if the condition fails. Hope to see this natively in the product someday.

[quote=“EggplantMatt”]Hi,

There’s currently no way to do this, but we consider it an interesting and valid feature request, so we’ll look at adding this as an option for a future release.

You could just use a conditional test rather than an assertion and then capture the screenshot if the condition is false.[/quote]

But in order to capture a screenshot, we have to do manually, which means halting the script execution?
Is my understanding correct?