Vous êtes sur la page 1sur 8

'===============================================================================

==========================
' Name of the Script : Master File Reports Subdepart
ment
' Scope of the Script : This test script covers 3 tes
t cases related to the Administration --> Subdepartment
' Author
: Imam Shareef
' Description : Administration Subdepartment
' Date and / or Version : 04-12-2008,version 1.0
'===============================================================================
============================
Sub MFAdministrationSubdepartment()
'****Declaration of Environmental Variable
Environment.Value("Execution_Log")=True
'''''''''Test case count
Const TC_COUNT = 3
strVar = Environment("TestDir")
strIndVar = Split(strVar,"\",-1,1)
strBound = UBound(strIndVar)
strAllPath =""
For intCounter = 0 to strBound - 1
strAllPath = strAllPath & strIndVar(intCounter)
&"\"
Next
strPath = Trim(strPath)
strDataPath = strAllPath & "DataTables\"
'****Adding MFLogin sheet to the dataTable and Importing the Inp
ut DataTable
DataTable.AddSheet "MFLogin"
DataTable.ImportSheet strDataPath & "Login.xls","MFLogin","MFLog
in"
DataTable.AddSheet "Subdepartment"
DataTable.ImportSheet strDataPath & "MasterFileReports.xls","Sub
department","Subdepartment"
DataTable.AddSheet "ReportHeader"
DataTable.ImportSheet strDataPath & "MasterFileReports.xls","Rep
ortHeader","ReportHeader"
DataTable.AddSheet "HomePageVerification"
DataTable.ImportSheet strDataPath & "MasterFileReports.xls","Hom
ePageVerification","HomePageVerification"
' Logs the Scenario name Execution in a .csv file
Call Execution_log(DataTable.Value("Scenario_Name", "Master"), "
", "", "")
'****Invoking IE and navigating to the ADR Login page
Call invoke_URL("MasterFile","Login Page",DataTable.Value("URL",
"MFLogin"))
'****Checking the username, password and login objects in the lo
gin page
Call pageCheck_WebEdit("MasterFile","Login Page","username;j_pas
sword","")
Call pageCheck_WebButton("MasterFile","Login Page","Login","")
'****Entering username and password and login into the masterfil
e application
Call login("MasterFile","Login Page","User","MFLogin")
Environment.Value("DATATABLE_ROW")=1
DataTable.GetSheet("Subdepartment").SetCurrentRow(Environment.Va
lue("DATATABLE_ROW"))
'***************************************** TC Driver Strat *****
**************************************************
For intTCCount =1 to TC_COUNT
Environment.Value("Execution_Log") = "True"
If DataTable("TestRunFlag","Subdepartment")="Y" Then ''If run
flag is Y in test data table
Reporter.ReportEvent micDone,"######## BEGIN TEST CASE - '" & Da
taTable("TestCaseID","Subdepartment") & "' ########### ","Execution of Test Case
'" & DataTable("TestCaseDesc","Subdepartment") & "' Started"
strFuncName = "MFAdministrationSubdepartment_TC" & intTCCount &
"()" ''Formation of function name
''Call Function
Execute "Call " & strFuncName
If Environment.Value("Execution_Log") = "True" Then
Call Execution_log("",Datatable.Value("TestCaseI
D", "Subdepartment"), Datatable.Value("TestCaseDesc", "Subdepartment"), "PASS")
Else
Call Execution_log("",Datatable.Value("TestCaseI
D", "Subdepartment"), Datatable.Value("TestCaseDesc", "Subdepartment"), "FAIL")
End If
Reporter.ReportEvent micDone,"######### END OF TEST CASE - '" &
DataTable("TestCaseID","Subdepartment") & "###########","The Test Case Execution
Completed"
End If
''Increment the test data table row
strPrevious=Trim(DataTable.Value("TestCaseID","Subdepartment"))
''Increment the test data table row
Environment.Value("DATATABLE_ROW") = Environment.Value("DATATABLE_ROW") + 1
DataTable.GetSheet("Subdepartment").SetCurrentRow(Environment.Value("DATATAB
LE_ROW"))
strNext=Trim(DataTable.Value("TestCaseID","Subdepartment"))
While strPrevious = strNext
Environment.Value("DATATABLE_ROW") = Environment.Value("DATATABLE_ROW") +
1
DataTable.GetSheet("Subdepartment").SetCurrentRow(Environment.Value("DATAT
ABLE_ROW"))
strNext=Trim(DataTable.Value("TestCaseID","Subdepartment"))
Wend
Next
Call logoutfromApp("MasterFile","Depositary Receipt Division's")
'***************************************** TC Driver End *******
************************************************
End Sub
'----------------Test Case 1 -----------------------------
Public Function MFAdministrationSubdepartment_TC1()
Environment.Value("TestCase_Log")="True"
' Datatable.GetSheet("Subdepartment").SetCurrentRow(1)
'Step #2
Call chkCAHomePage("MasterFile","Depositary Receipt Division's",
DataTable.Value("HomePageLinks","Subdepartment"),DataTable.Value("CurrentUser","
Subdepartment"))
Call click_webElement("MasterFile","Depositary Receipt Division'
s","MasterFile")
Call select_Menu("MasterFile","MasterFile",Datatable.Value("Menu
Path","Subdepartment"))
Call pageCheck_WebEditOR("MasterFile","Administration - Subdepar
tment","Subdepartment;SubDeptCode")
Call pageCheck_WebElementinTable("MasterFile","Administration -
Subdepartment","Subdepartment;Subdepartment Code","Subdepartment Search Results"
)
Call pageCheck_ImageOR("MasterFile","Administration - Subdepartm
ent","New;Clear;Search")
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 2: Under Repo
rts menu select Subdepartment.","Expected fields are displayed in search criteri
a"
Else
Reporter.ReportEvent micFail,"Step2: Under Repor
ts menu select Subdepartment.","Expected fields are not displayed in search crit
eria"
Environment.Value("TestCase_Log")="True"
End If
'Step #3
If DataTable.Value("Subdepartment","Subdepartment")<> "" Then
Call set_WebEdit_Value("MasterFile","Administrat
ion - Subdepartment","Subdepartment",DataTable.Value("Subdepartment","Subdepartm
ent"))
End If
' If DataTable.Value("SubdepartmentCode","Subdepar
tment")<> "" Then
' Call set_WebEdit_Value("MasterFi
le","Administration - Subdepartment","SubDeptCode",DataTable.Value("Subdepartmen
tCode","Subdepartment"))
' End If
Call click_Image("MasterFile","Administration - Subdepartment","
Search")
Call pageCheck_WebElementinTable("MasterFile","Administration -
Subdepartment","Subdepartment;Subdepartment Code","Subdepartment Search Results"
)
Call select_Menu("MasterFile","Administration - Subdepartment","
HOME;DR Home")
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 3: Enter the
values for theSubdepartmentName,SubdepartmentCode Fields and click on search.
.","Expected fields are displayed in search criteria"
Else
Reporter.ReportEvent micFail,"Step3: Enter the
values for the SubdepartmentName,SubdepartmentCode Fields and click on search..
","Expected fields are Not displayed in search criteria"
Environment.Value("TestCase_Log")="True"
End If
End Function
'-----------------Test Case2--------------------------------------------
Public Function MFAdministrationSubdepartment_TC2()
Environment.Value("TestCase_Log")="True"
' Datatable.GetSheet("Subdepartment").SetCurrentRow(2)
'Step #2
Call chkCAHomePage("MasterFile","Depositary Receipt Division's",Dat
aTable.Value("HomePageLinks","Subdepartment"),DataTable.Value("CurrentUser","Sub
department"))
Call click_webElement("MasterFile","Depositary Receipt Division'
s","MasterFile")
Call select_Menu("MasterFile","MasterFile",Datatable.Value("Menu
Path","Subdepartment"))
Call pageCheck_WebEditOR("MasterFile","Administration - Subdepar
tment","Subdepartment;SubDeptCode")
Call pageCheck_WebElementinTable("MasterFile","Administration -
Subdepartment","Subdepartment;Subdepartment Code","Subdepartment Search Results"
)
Call pageCheck_ImageOR("MasterFile","Administration - Subdepartm
ent","New;Clear;Search")
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 2: Under Repo
rts menu select SubSubdepartment.","Expected fields are displayed in search crit
eria"
Else
Reporter.ReportEvent micFail,"Step2: Under Repor
ts menu select SubSubdepartment.","Expected fields are not displayed in search c
riteria"
Environment.Value("TestCase_Log")="True"
End If
'Step #3
If DataTable.Value("Subdepartment","Subdepartment")<> "" Then
Call set_WebEdit_Value("MasterFile","Administrat
ion - Subdepartment","Subdepartment",DataTable.Value("Subdepartment","Subdepartm
ent"))
End If
' If DataTable.Value("SubdepartmentCode","Subdepar
tment")<> "" Then
' Call set_WebEdit_Value("MasterFi
le","Administration - Subdepartment","SubDeptCode",DataTable.Value("Subdepartmen
tCode","Subdepartment"))
' End If
Call click_Image("MasterFile","Administration - Subdepartment","
Search")
Call pageCheck_WebElementinTable("MasterFile","Administration -
Subdepartment","Subdepartment;Subdepartment Code","Subdepartment Search Results"
)
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 3: Enter the
values for theSubdepartmentName,SubdepartmentCode Fields and click on search.
.","Expected fields are displayed in search criteria"
Else
Reporter.ReportEvent micFail,"Step3: Enter the
values for the SubdepartmentName,SubdepartmentCode Fields and click on search..
","Expected fields are Not displayed in search criteria"
Environment.Value("TestCase_Log")="True"
End If
'Step#4
Call SelectValueinTable("MasterFile","Administration - Subdepart
ment","ADR Index","ADR Index")
strDeptPage=Trim(Browser("MasterFile").Page("Subdepartment Detai
l").WebElement("Subdepartment Detail").GetROProperty("innertext"))
If strDeptPage="Subdepartment Detail" Then
Reporter.ReportEvent micPass,"Step4:Verify the S
ubdepartment Detail page displayed or not"," Subdepartment DetailPage displayed
successfully"
Else
Reporter.ReportEvent micFail,"Step4:Verify the
Subdepartment Detail Page is displayed or not"," Subdepartment Detail page is no
t displayed successfully"
End If
'Step#5
Call click_Image("MasterFile","Subdepartment Detail","Related Pr
ofiles")
If Browser("MasterFile").Page("Subdepartment Detail").Frame("lo
okupFrame").WebElement("Related Profiles").Exist Then
Reporter.ReportEvent micPass,"Step 5: After Clic
king on the Related Profiles Check whether the Required Page exist or not ..","E
xpected Page exist with all the related values"
Environment.Value("TestCase_Log")="True"
Else
Reporter.ReportEvent micFail,"Step5: After Click
ing on the Related Profiles Check whether the Required Page exist or not ..","Ex
pected PageDoes not exist with all the related values"
Environment.Value("TestCase_Log")="True"
End If
'Step#6
Call click_Image("MasterFile","Subdepartment Detail","Delete Pro
file")
If Browser("MasterFile").Dialog("Microsoft Internet Explorer").
Exist Then
Reporter.ReportEvent micPass,"Step 6: After Clic
king on the Delete Check the Message Box Exists or not .","Msgbox Exist and is
Clicked on Successfully."
Else
Reporter.ReportEvent micFail,"Step 6: After Clic
king on the Delete Check the Message Box Exists or not .","Msgbox Does not Exis
t and is Not Clicked on Successfully."
Environment.Value("TestCase_Log")="True"
End If
'Step#7
Browser("MasterFile").Dialog("Microsoft Internet Explorer").WinB
utton("OK").Click
If Browser("MasterFile").Page("Profile Dependencies").WebTable("
delete failed:").Exist Then
Reporter.ReportEvent micPass,"Step 7: After Clic
king on the The Required Button Check Whether the Relevant Page Exists or not
.","Expected Page exist with all the related values."
Else
Reporter.ReportEvent micFail,"Step 7: After Clic
king on the Delete Check the Message Box Exists or not .","Expected PageDoes no
t exist with all the related values"
Environment.Value("TestCase_Log")="True"
End If
Call select_Menu("MasterFile","Profile Dependencies","HOME;DR Ho
me")
End Function
'-----------------Test Case3--------------------------------------------
Public Function MFAdministrationSubdepartment_TC3()
Environment.Value("TestCase_Log")="True"
'Datatable.GetSheet("Subdepartment").SetCurrentRow(3)
'Step #2
Call chkCAHomePage("MasterFile","Depositary Receipt Division's",
DataTable.Value("HomePageLinks","Subdepartment"),DataTable.Value("CurrentUser","
Subdepartment"))
Call click_webElement("MasterFile","Depositary Receipt Division'
s","MasterFile")
Call select_Menu("MasterFile","MasterFile",Datatable.Value("Menu
Path","Subdepartment"))
Call pageCheck_WebEditOR("MasterFile","Administration - Subdepar
tment","Subdepartment;SubDeptCode")
Call pageCheck_WebElementinTable("MasterFile","Administration -
Subdepartment","Subdepartment;Subdepartment Code","Subdepartment Search Results"
)
Call pageCheck_ImageOR("MasterFile","Administration - Subdepartm
ent","New;Clear;Search")
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 2: Under Repo
rts menu select SubSubdepartment.","Expected fields are displayed in search crit
eria"
Else
Reporter.ReportEvent micFail,"Step2: Under Repor
ts menu select SubSubdepartment.","Expected fields are not displayed in search c
riteria"
Environment.Value("TestCase_Log")="True"
End If
'Step #3
Call click_Image("MasterFile","Administration - Subdepartment","
New")
Call pageCheck_WebEditOR("MasterFile","Subdepartment Detail","Su
bdepartment_New;SubdepartmentCode_New")
Call pageCheck_ImageOR("MasterFile","Subdepartment Detail","Rela
ted Profiles;Delete Profile;Save Profile")
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 3: After Clic
king on the New Image Check Whether the Expected Fields are Present or not .","E
xpected fields are displayed in search criteria"
Else
Reporter.ReportEvent micFail,"Step3: After Click
ing on the New Imagw Check Whether the Expected Fields are Present or not .","E
xpected fields are not displayed in search criteria"
Environment.Value("TestCase_Log")="True"
End If
'Step#4
If DataTable.Value("Subdepartment_New","Subdepartment")<> "" T
hen
Call set_WebEdit_Value("MasterFile","Subdepartme
nt Detail","Subdepartment_New",DataTable.Value("Subdepartment_New","Subdepartmen
t"))
End If
If DataTable.Value("SubdepartmentCode_New","Subdepartment")<> ""
Then
Call set_WebEdit_Value("MasterFile","Subdepartme
nt Detail","SubdepartmentCode_New",DataTable.Value("SubdepartmentCode_New","Subd
epartment"))
End If
Call click_Image("MasterFile","Subdepartment Detail","Save Prof
ile")
If Environment.Value("TestCase_Log")="True" Then
Reporter.ReportEvent micPass,"Step 4: After Ente
r the Values and Clicking Check whether the Values are Saved or Not .","New Sub
Subdepartmentis Created Successfully"
Else
Reporter.ReportEvent micFail,"Step 4: After Ente
r the Values and Clicking Check whether the Values are Saved or Not .","New Sub
Subdepartmentis Not Created Successfully"
Environment.Value("TestCase_Log")="True"
End If
'Step#5
Call click_Image("MasterFile","Subdepartment Detail","Delete Pro
file")
If Browser("MasterFile").Dialog("Microsoft Internet Explorer
").Static("Are you sure you want").Exist Then
Reporter.ReportEvent micPass,"Step 5: After Clic
king on the The Required Button Check Whether the Dialog Box is Present .","Di
alog Box is Present with all the Relevant Values."
Else
Reporter.ReportEvent micFail,"Step 5: After Clic
king on the The Required Button Check Whether the Dialog Box is Present .","Di
alog Box is not Present with all the Relevant Values."
Environment.Value("TestCase_Log")="True"
End If
'Step#6
Browser("MasterFile").Dialog("Microsoft Internet Explorer").WinB
utton("Cancel").Click
If Browser("MasterFile").Page("Subdepartment Detail").WebTable
("Subdepartment Detail").Exist Then
Reporter.ReportEvent micPass,"Step 6: After Clic
king on the The Required Button Check Whether the Page exist or not .","Expect
ed Page is Presentwith all the related values."
Environment.Value("TestCase_Log")="True"
Else
Reporter.ReportEvent micFail,"Step 6: After Cli
cking on the The Required Button Check Whether the Page exist or not .","Expec
ted Page is not Presentwith all the related values."
Environment.Value("TestCase_Log")="True"
End If
'Step#7
Call click_Image("MasterFile","Subdepartment Detail","Delete Pro
file")
Browser("MasterFile").Dialog("Microsoft Internet Explorer").WinB
utton("OK").Click
If Browser("MasterFile").Page("Administration - Subdepartment").
WebElement("Administration - Subdepartment Search").Exist Then
Reporter.ReportEvent micPass,"Step7: After Click
ing on the The Required Button Check Whether the New Subdepartment Created is De
leted or not .","The New Subdepartment is Deleted and the Cursor is Returned b
ack to the Administration - Subdepertment Search page"
Environment.Value("TestCase_Log")="True"
Else
Reporter.ReportEvent micFail,"Step 7: After Clic
king on the The Required Button Check Whether the New Subdepartment Created is D
eleted or not .","The New Subdepartment is not Deleted and the Cursor is not
Returned back to the Administration - Subdepertment Search page"
Environment.Value("TestCase_Log")="True"
End If
Call select_Menu("MasterFile","Administration - Subdepartment","
HOME;DR Home")
End Function

Vous aimerez peut-être aussi