Last seen screen automatically saved

I understand that Eggplant will automatically save the last seen screen if there is any error occurs during the run. It will be saved as Screen_Error.tiff under Results folder.

I've a script like this, whereby it should kill the tested application if it failed to run properly (execute the catch Exception block), follow by performing clean-up. I notice that the Screen_Error.tiff captured by Eggplant does not always reflect the last screen seen in the "try" block. But rather, most of the time, Eggplant captures the command-line prompt taken from the CleanUp function.
try
	(* Perform test steps here *)
catch Exception
	(* Kill tested application before exit *)
	run KillApplication <application>
	
	(* Clean-up - this function works in command line mode, and it does not bring up any GUI *)
	run CleanUp

	(* Issue error messages before exit *)
	LogError "Failed to run update symbol or block test"
	LogError Exception.reason
end try

I know that Eggplant has a function called CaptureScreen to let tester determines which screen and when to capture it. I guess the reason why Eggplant captures the wrong screen as the last seen screen could be due to timing problem? Is there any other way to control the timing when Eggplant captures the last seen screen in "try" block?


regards
Ai Choo

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Have you tried adding a CaptureScreen command as the first line inside the catch block? That should generate a screen image at the time when the exception was thrown.

    If you have a problematic section of code that you need to focus on you could also try using Eggplant's screen tracing feature. Surround that part of your test with TraceScreen On and TraceScreen Off commands, and Eggplant will capture screen images automatically on every command. You'll want to limit the use of that feature, as the screen images can consume a lot of disk space in a hurry, but it may be useful in some situations.
Sign In or Register to comment.