e2e_appmon - how to generate and save screenshots on script failures
search cancel

e2e_appmon - how to generate and save screenshots on script failures

book

Article ID: 278688

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM) CA Unified Infrastructure Management On-Premise (Nimsoft / UIM) CA Unified Infrastructure Management SaaS (Nimsoft / UIM)

Issue/Introduction

Where is the documentation on how the e2e_appmon probe can run and while the test runs it will take screen shots (screen dumps) of the screen as the test is running? Then when there is a failure we can go and look at the screen shots to see where the test failed at? This is something we used to have setup a while ago, and due to lack of time when we upgraded UIM we lost it. We are looking to set this up again and bring it back.

Environment

  • e2e_appmon v3.01

Cause

  • Guidance

Resolution

Please refer to the e2e_appmon probe-> Profile Run Properties Tab:

e2e_appmon IM GUI Reference

On timeout
Dump screen on timeout
Saves the snapshot of the application when the NimRecorder script execution time exceeds the limit. Right-click the profile under the Status tab and select the View screendumps option to view the screen dump for the profile.

The screen dumps are saved in the following directory in the e2e workstation:
C:\Program Files (x86)\Nimsoft\probes\application\e2e_appmon\screendump\<profile_name>

Additional Information

For scripting, there is a WinTask Capture option as well-> HardCopy*

'Take a screenshot of the desktop
file_path$="D:\Program Files\Nimsoft\probes\application\e2e_appmon\screendump\"+#ErrorScript$+"_error"
ret=Hardcopy(file_path$+".jpg",1,1)

'It would be included in an error handling sub-routine. For example:

'Below is a generic error handling routine
Sub Process_Error()
local buffer$

'If within this proc, an error occurs too, it generates an infinite loop as

'the call to the error process causes an error. To avoid that, we disable OnAction Error within this proc.

disable(Error)


'Take a screenshot of the desktop

file_path$="D:\Program Files\Nimsoft\probes\application\e2e_appmon\screendump\"+#ErrorScript$+"_error"

ret=Hardcopy(file_path$+".jpg",1,1)


'Here a part for writing in a txt file where we were in the script, the error code, the error message when the error occurred.

buffer$="------ "+Date$()+ " - "+Time$()+" -------"

write(file_path$+".txt",buffer$,crlf)

buffer$="Error in : "+#ErrorScript$

write(file_path$+".txt",buffer$,crlf)

buffer$="Error line : "+str$(#LastErrorLine)

write(file_path$+".txt",buffer$,crlf)

buffer$="Error Code : "+str$(#Errorcode)

write(file_path$+".txt",buffer$,crlf)

buffer$="Error Function : "+#ErrorFunction$

write(file_path$+".txt",buffer$,crlf)

buffer$="Error message : "+#ErrorMsg$

write(file_path$+".txt",buffer$,crlf)

'Add here other lines for what to do in case of an error.

'......

nimQoSStop() 'Stops the QoS timer.

nimQoSSendNull(target$) 'Send the response time measurement- timeout value per customer

nimSetVariable("suppression_id",#ErrorScript$+"-Script error")

'nimAlarmSimple (4,"Error in : "+#ErrorScript$+" at line : "+str$(#LastErrorLine)+" Error Function: "+#ErrorFunction$+"Error message : "+#ErrorMsg$) ' Sends a major alert that the script did not run. The number 5 is critical 4 is major, etc

nimEnd()

KillApp("IEXPLORE",1) 'Kill any runnning Internet Explorers

End(-1)

Endsub
'--------------------------------------------------------------

The file_path$ variable determines the location where the screenshot is saved. This part is the location -- "D:\Program Files\Nimsoft\probes\application\e2e_appmon\screendump\" 

The name of the screenshot file is -- +#ErrorScript$+"_error"

with the jpg extension added in the next line -- ret=Hardcopy(file_path$+".jpg",1,1)