Capturing and attaching screenshot for failed step


The below code capture screenshot and places the file in a specific location.

fCnt is a public variables to be declared in function library and initialized to 0

Public function capture_scrshot
       fCnt=fCnt+1
    desktop.CaptureBitmap"d:\Screenshots\" & fCnt & ".png",True
    capture_scrshot="d:\Screenshots\" & fCnt & ".png"
end  Function


This file can be attached to the failed step by calling this function as below

reporter.ReportEvent  micFail,"Step description","Step details",capture_scrshot