March 07, 2011

Capturing screenshot and window declarations when an error occurrs in the testcase execution.


// To achieve this you need to override the recovery system, you need to write your own TestCaseExit function as below.

[-] void TestCaseExit (boolean bException)
   [ ]
   [ ] List of string lsErrorPageDeclarations
   [ ] string sExceptionBitmapFile = "AbsoluteBitmapFilePath"
   [ ]
   [-] if bException == True
      [ ] // Test case failed
      [ ]
      [ ] // Delete any bitmaps from a previous Exception.
      [-] if SYS_FileExists(sExceptionBitmapFile)
         [ ]
         [ ] SYS_RemoveFile(sExceptionBitmapFile)
      [ ]
      [ ] // Go to the top of the form.
      [ ] BrowserPage.Click(1,1,1)
      [ ] BrowserPage.TypeKeys("")
      [ ]
      [ ] Desktop.CaptureBitmap (sExceptionBitmapFile)
      [ ] lsErrorPageDeclarations = BrowserPage.GenerateDecl ()
      [ ]
      [ ] Print("---------------------------------------------------------------------------")
      [ ] ResOpenList ("The declarations for the current BrowserChild are:")
      [ ] Print("---------------------------------------------------------------------------")
      [ ]
      [ ] ListPrint (lsErrorPageDeclarations)
      [ ]
      [ ] ResCloseList()

0 comments: