Any other way to recognise objects other than Name Mapping
I am doing R&D on Test Complete and recommend Client for their Automation, in simple POC(Proof of Concept). But i am just wondering if there is any other way to add objects other than Name Mapping.
I am trying to declare all the objects in one Script editor and try to retrieve those objects in another Script editor (I have associated those 2 Script editors by using Add Unit References).
But when i run the script i am getting run time error, since the objects are already read by the Test Complete and the screen is not available(application start up script is involved). Below is the script.
Can anyone tell me if there is any other way where in i store all my objects in one place and call them when required. As Descriptive programming!
When i declare my objects in the same function then it works
First Script Unit where all the objects are stored :
set wnd_Login=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in")
set txt_Login_UserName=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in").WPFObject("LoginWindow", "DMS Client uat1 - log in", 1).WPFObject("Grid", "", 1).WPFObject("_userName")
set txt_Login_Password=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in").WPFObject("LoginWindow", "DMS Client uat1 - log in", 1).WPFObject("Grid", "", 1).WPFObject("passwordBox")
set cmb_Login_Environment=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in").WPFObject("LoginWindow", "DMS Client uat1 - log in", 1).WPFObject("Grid", "", 1).WPFObject("combo")
set btn_Login_EditConnSettings=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in").WPFObject("LoginWindow", "DMS Client uat1 - log in", 1).WPFObject("Grid", "", 1).WPFObject("Button", "", 1)
set btn_Login_OK=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in").WPFObject("LoginWindow", "DMS Client uat1 - log in", 1).WPFObject("Grid", "", 1).WPFObject("Border", "", 1).WPFObject("UniformGrid", "", 1).WPFObject("Button", "_OK", 1)
set btn_Login_Cancel=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in").WPFObject("LoginWindow", "DMS Client uat1 - log in", 1).WPFObject("Grid", "", 1).WPFObject("Border", "", 1).WPFObject("UniformGrid", "", 1).WPFObject("Button", "_Cancel", 2)
'''''Login Failed
set dlg_AuthenticationError=Sys.Process("DMS.GUI.uat1").Window("#32770", "Authentication Error", 1)
set static_AuthenticationError_ErrorText=Sys.Process("DMS.GUI.uat1").Window("#32770", "Authentication Error", 1).Window("Static", "Logon failed (username and/or password are invalid)", 2)
set btn_AuthenticationError_OK=Sys.Process("DMS.GUI.uat1").Window("#32770", "Authentication Error", 1).Window("Button", "OK", 1)
Second Script Unit where i am calling my function which uses the above Objects:
Sub Test()
Call DMSLogin ("abcd","xyz", True)
End Sub
Function DMSLogin(strUserName,strPwd,blnNegetiveScenario)
' Quit if Login window doesn't exists
If wnd_Login.Exists <> True Then
Log.Error "DMS Login Window doesn't exists. Quitting.."
DMSLogin = False
Exit Function
End If
wnd_Login.Activate()
' Login with user crendentials
msgbox strUserName
msgbox strPwd
txt_Login_UserName.wText = strUserName
txt_Login_Password.wText = strPwd
btn_Login_OK.Click()
' Some times Ok button is taking time to refresh, If not able to click Ok button again we are clicking
Log.Enabled = False
If wnd_Login.Exists = True Then
btn_Login_OK.Click()
End If
Log.Enabled = True
builtin.delay(5000)
show_hid_icons_expander.click
button_Count=Notification_area.wButtonCount
for i=0 to button_Count-1
if Notification_area.WButtonText(i,True)="DMS Client test (Default)" then
DMS_Login_Status="True"
end if
next
if DMS_Login_Status="True" then
' DMSLogin="PASS"
' UPDATE_HTML_TEST_STEPLEVEL_DETAILED_RESULTS fnc_StepNo,"DMSLogin","Verify Login","User should be logged in","User logged into the application","PASS"
' WriteResult micPass, "Verify DMS Login window", "User logged in successfully",FALSE
log.Message "Login Successful"
else
' DMSLogin="FAIL"
' UPDATE_HTML_TEST_STEPLEVEL_DETAILED_RESULTS fnc_StepNo,"DMSLogin","Verify Login","User should be logged in","Failed to gain the access","FAIL"
' WriteResult micFail, "Verify DMS Login window", "Failed to login to the application",FALSE
log.Message "Login unSuccessful"
End If
End Function
Thanks in Advance
Thrilok