Here is what I use to create deliverables after I finish an automated testing.
1) Having screenshots to submit for a web application.
I created this library routine Click_Picture that takes a picture of the entire browser screen(even parts that are not currently visible on the screen) and stores them at a desired location.
1) picNum starting from 1000 helps sort the pictures in the folder in the order it was taken. You can use/change/discard it as you desire.
2) fldrPath_TestRun is a folder I create at the beginning of each test to save any files related to my current test run.
3) strPicName is a short descriptor for the picture that is being taken. A convention I use is 'B' means before and 'A' means after. e.g.
'A_Login' means after login
'B_SubmitForm' means before submitting the form.
4) PagePicture is a method that TestComplete provides to capture a complete image of the tested object.
5) lib_FileCopy is any library function that can copy the picture from where TestComplete saves it to the desired folder.
DIM picNum: picNum = 1000
DIM fldrPath_TestRun
fldrPath_TestRun = "C:\TC11Projects\03012016_103216AM"
PUBLIC FUNCTION Save_PagePicture(ByVal strPicName)
DIM src_Path, dest_Path
picName = picNum & "_" & TRIM(strPicName)
src_Path = Log.Picture(Sys.browser.Page("*").PagePicture, "Saving page picture")
dest_Path = fldrPath_TestRun & "\" & picName & ".png"
CALL lib_FileCopy(src_Path, dest_Path)
Log.Message("SAVED PICTURE:")
Log.Message(dest_Path)
END FUNCTION
1) Having screenshots to submit for a web application.
I created this library routine Click_Picture that takes a picture of the entire browser screen(even parts that are not currently visible on the screen) and stores them at a desired location.
1) picNum starting from 1000 helps sort the pictures in the folder in the order it was taken. You can use/change/discard it as you desire.
2) fldrPath_TestRun is a folder I create at the beginning of each test to save any files related to my current test run.
3) strPicName is a short descriptor for the picture that is being taken. A convention I use is 'B' means before and 'A' means after. e.g.
'A_Login' means after login
'B_SubmitForm' means before submitting the form.
4) PagePicture is a method that TestComplete provides to capture a complete image of the tested object.
5) lib_FileCopy is any library function that can copy the picture from where TestComplete saves it to the desired folder.
DIM picNum: picNum = 1000
DIM fldrPath_TestRun
fldrPath_TestRun = "C:\TC11Projects\03012016_103216AM"
PUBLIC FUNCTION Save_PagePicture(ByVal strPicName)
DIM src_Path, dest_Path
picName = picNum & "_" & TRIM(strPicName)
src_Path = Log.Picture(Sys.browser.Page("*").PagePicture, "Saving page picture")
dest_Path = fldrPath_TestRun & "\" & picName & ".png"
CALL lib_FileCopy(src_Path, dest_Path)
Log.Message("SAVED PICTURE:")
Log.Message(dest_Path)
END FUNCTION
No comments:
Post a Comment