Thursday, December 29, 2011
Free QTP Framework
Above are the sixth components in my framework..
Now with the help of driver script you can complete your Test Automation..
'Adding sheets to Run-time data table
DataTable.AddSheet "Module"
DataTable.AddSheet "TestCase"
DataTable.AddSheet "TestStep"
DataTable.AddSheet "Login"
'Importing data from External File
DataTable.ImportSheet "C:\Documents and Settings\ShahadatK\Desktop\Proj_Automation\Orginizer\Organizer.xls",1,3
DataTable.ImportSheet "C:\Documents and Settings\ShahadatK\Desktop\Proj_Automation\Orginizer\Organizer.xls",2,4
DataTable.ImportSheet "C:\Documents and Settings\ShahadatK\Desktop\Proj_Automation\Orginizer\Organizer.xls",3,5
DataTable.ImportSheet "C:\Documents and Settings\ShahadatK\Desktop\Proj_Automation\TestData\data.xls",1,6
'Capturing Executable Modules from Module Sheet
MRowCount=DataTable.GetSheet("Module").GetRowCount
For i=1 to MRowCount Step 1
DataTable.SetCurrentRow(i)
ModuleExe=DataTable(3,"Module")
If UCase(ModuleExe)="Y" Then
ModuleId=DataTable(1,"Module")
'Msgbox "ModuleId: " & ModuleId
' Capturing executable test cases under executable modules
TCRowCount=DataTable.GetSheet("TestCase").GetRowCount
For j=1 to TCRowCount Step 1
DataTable.SetCurrentRow(j)
TCCaseExe=DataTable(3,"TestCase")
ModuleId2=DataTable(4,"TestCase")
If UCase(TCCaseExe)="Y" and ModuleId=ModuleId2 Then
TestCaseId=DataTable(1,"TestCase")
'Msgbox TestCaseId
'Capturing keywords for executable steps
TSRowCount=DataTable.GetSheet("TestStep").GetRowCount
For k=1 to TSRowCount Step 1
DataTable.SetCurrentRow(k)
TestCaseId2 = DataTable(5,"TestStep")
If TestCaseId=TestCaseId2 Then
keyword=DataTable(4,"TestStep")
'msgbox keyword
Select Case keyword
Case "ln"
Result=Login("abcd","mercury")
DataTable(7,"TestStep")=Result
Msgbox Result
Case "oo"
Result=Open_Order(5)
DataTable(7,"TestStep")=Result
Case "uo"
Result=Update_Order(5)
DataTable(7,"TestStep")=Result
Case "ca"
Close_App()
Case "lnd"
Rows=DataTable.GetSheet("Login").GetRowCount
For m=1 to Rows Step 1
DataTable.SetCurrentRow(m)
Result=Login2(DataTable(1,"Login"),DataTable(2,"Login"))
DataTable(3,"Login")=Result
Next
Case "ood"
Rows=DataTable.GetSheet("Login").GetRowCount
For n=1 to Rows Step 1
DataTable.SetCurrentRow(n)
Result=Open_Order2(DataTable(4,"Login"))
DataTable(5,"Login")=Result
Next
Case "uod"
Rows=DataTable.GetSheet("Login").GetRowCount
For p=1 to Rows Step 1
DataTable.SetCurrentRow(p)
Result=Update_Order2(DataTable(6,"Login"))
DataTable(7,"Login")=Result
Next
End Select
End If
Next
End If
Next
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\ShahadatK\Desktop\Proj_Automation\TestResult\Result1.xls","TestStep"
DataTable.ExportSheet "C:\Documents and Settings\ShahadatK\Desktop\Proj_Automation\TestResult\Result1.xls","Login"
Subscribe to:
Posts (Atom)