Sie sind auf Seite 1von 23

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

Thatavarti QTP Architecture Implementation Document

Author T.V.RadhaKrishna

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential About Thatavarti

Independent Testing Company

Thatavarti Technologies Pvt. Ltd (TT) is a next generation cutting-edge enterprise and a leading provider of independent software testing services. We are renowned for executing prestigious projects for global IT giants. The company comprises an outstanding team of highly spirited software testing professionals, who are spread across its offices in India and overseas. They are collectively accelerating the company's growth by providing unparalleled software testing services. TT is uniquely positioned to create value and provide competitive advantages to its customers. Its professional management is driving the company to higher orbits of excellence. It's commitment to help customers maximize the business value of IT and its successful track record of accomplishments over time in delivering competitive advantages is a standing testimony to its capabilities and efficiencies. Effort Invested: Thatavarti has invested 40 man months effort to understand industry standard application, then design and code the automation architecture that can be implemented across the industry standard automation tools. In this white paper all our examples are 100% implementation friendly in Mercury QTP.

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential Architecture Diagram

Independent Testing Company

Folder Structure implemented in Architecture:

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

1. Object Repository (OR) Learn all the objects related to application. Steps involved are : 1. List the total windows in the current application add all the windows with descendant objects into OR. (Object Repository <add objects>. 2. Change the window names and object names according to your own naming conventions 3. The above steps will enable you to get the complete grip on OR. 02. Test Scenarios (TS) Set of test cases is called a test scenario. Test case is a description one action with associated data and what to be tested. 1. Collect all the TS that are applicable for automation and review it twice to check whether all test cases are independent. 2. Add 2 column names i.e WebPage/Window and Objects Map each test case with the respective windows and objects. 3. Add Test Data column and analyze whether the respective case will have data. Need to understand is the data is dynamic or selected from application drop downs 4. List all the preconditions required to execute the respective test scenario the respective tests should be chosen as Start-up script. 5. Add a column Repeated If a particular test cases or set of test cases are repeated; the choose them as functions. If the functionality is associated with business mark it as a Business Function else Generic Function. Functions All the functions are developed using the Object Oriented Methodology. Business Functions Related to one window are handled in one class Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

Generic functions like Database connectivity are handled in single class All the function should be written in notepad and save it as .vbs files. This .vbs files should be executed in Driver script to access the all related functions. Generic Functions '********************************************************************** ' Class Name : DBConnect ' Start Date : 28/02/06 ' End Date : 28/02/06 ' Author : Thatavarti Technologies Pvt. Ltd ' Reviewed By : Thatavarti Technologies Pvt. Ltd ' Reviewed Date : 28/02/06 '********************************************************************** class DBConnect Dim objdbConnection Dim objRecordset '**************************************************************** ' Function Name : getDBConnection ' Input Parameters : -Nil' Description : This Function is used to Establish Database Connection. '**************************************************************** Function getDBConnection() Set objdbConnection = CreateObject("ADODB.Connection") objdbConnection.open "dsn=Syscon_Connect" getDBConnection = objdbConnection.state End Function '**************************************************************** ' Function Name : getFieldValue ' Input Parameters : strFieldName ' Description : This Function is used to Fetch a Record From Database. '**************************************************************** Function getFieldValue(strFieldName) Set objRecordSet = CreateObject("ADODB.Recordset") objRecordSet.Open "Select " & strFieldName & " From SysconCronus",objdbConnection,1,1 getFieldValue = objRecordSet(0) End Function '**************************************************************** ' Function Name : getLoginValue ' Input Parameters : strFieldName ' Description : This Function is used to Fetch a Record From Database. '**************************************************************** Function getLoginValue(strFieldName) Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

Set objRecordSet = CreateObject("ADODB.Recordset") objRecordSet.Open "Select " & strFieldName & UserLogin",objdbConnection,1,1 getLoginValue = objRecordSet(0) End Function

"

From

Function ClearItems dim dbconnect set dbconnect = createobject("ADODB.Connection") dbconnect.open "dsn=cronus; uid=sa;pwd=sa" If (dbConnect.state=1) Then dbconnect.execute "delete from dbo.allitem where itemcode between '900' and '2000'" 'dbconnect.execute "delete from dbo.itemmast where itemcode between '900' and '2000'" str=true else str=false End If set dbconnect = nothing ClearItems=str End Function End Class

Business Functions ' Copyright Thatavarti Technologies

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

'**************************************************************************** ' Class Name : ItemMaster ' Window It Represents : Item Master ' Start Date : 28/8/06 ' End Date : 28/8/06 ' Author : Thatavarti Technologies Pvt. Ltd ' Reviewed By : Thatavarti Technologies Pvt. Ltd ' Reviewed Date : 28/8/06 '**************************************************************************** Class wndItemMaster '*************************************************************************** ******* ' Procedure Name : setItemCode ' Input Parameters : strItemCode ' Description : This Procedure is used to Set the ItemCode in the Item Master window. '*************************************************************************** ******* Sub setItemCode(strItemCode) If (vbWindow("ItemMaster").VbComboBox("ItemCode").Exist(20)) Then If (vbWindow("ItemMaster").VbComboBox("ItemCode").GetROProperty("enabled") = True)Then vbWindow("ItemMaster").VbComboBox("ItemCode").Type strItemCode End If End If End Sub '*************************************************************************** ******* ' Procedure Name : setItem ' Input Parameters : strItem ' Description : This Procedure is used to Set the Item in the Item Master window. '*************************************************************************** ******* Sub setItem (strItem) If (vbWindow("ItemMaster").VbComboBox("Item").Exist(20)) Then If(vbWindow("ItemMaster").VbComboBox("Item").GetROProperty("enabled")=True) Then vbWindow("ItemMaster").VbComboBox("Item").Type strItem vbWindow("ItemMaster").VbComboBox("Item").Type micreturn End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectAcceptedBy ' Input Parameters : strAcceptedBy Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

' Description : This Procedure is used to Select the AcceptedBy Department in the Item Master window. '*************************************************************************** ******* Sub selectAcceptedBy(strAcceptedBy) If (vbwindow("ItemMaster").VbComboBox("AcceptedBy").Exist(20) )then If(vbWindow("ItemMaster").VbComboBox("AcceptedBy").GetROProperty("Enabled")= True)Then vbWindow("ItemMaster").VbComboBox("AcceptedBy").Select strAcceptedBy End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectLocation ' Input Parameters : strLocation ' Description : This Procedure is used to Select the select Location in the Item Master window. '*************************************************************************** ******* Sub selectLocation(strLocation) If (vbwindow("ItemMaster").VbComboBox("Location").Exist(20) )then If(vbWindow("ItemMaster").VbComboBox("Location").GetROProperty("Enabled")= True)Then vbWindow("ItemMaster").VbComboBox("Location").Select strLocation End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectGroup ' Input Parameters : strGroup ' Description : This Procedure is used to Select the select Group in the Item Master window. '*************************************************************************** ******* Sub selectGroup(strGroup) If (vbwindow("ItemMaster").VbComboBox("Group").Exist(20) )then If(vbWindow("ItemMaster").VbComboBox("Group").GetROProperty("Enabled")= True)Then vbWindow("ItemMaster").VbComboBox("Group").Select strGroup End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectClass Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

' Input Parameters : strClass ' Description : This Procedure is used to Select the select Class in the Item Master window. '*************************************************************************** ******* Sub selectClass(strClass) If (vbwindow("ItemMaster").VbComboBox("Class").Exist(20) )then If(vbWindow("ItemMaster").VbComboBox("Class").GetROProperty("Enabled")= True)Then vbWindow("ItemMaster").VbComboBox("Class").Select strClass End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectForSales ' Input Parameters : strChkBoxVal ' Description : This Procedure is used to Click For Sales in the Item Master window. '*************************************************************************** ******* Sub selectForSales(strChkBoxVal) If (vbwindow("ItemMaster").VbCheckBox("ForSales").Exist(20)) then If(vbWindow("ItemMaster").VbCheckBox("ForSales").GetROProperty("Enabled")= True)Then vbWindow("ItemMaster").VbCheckBox("ForSales").Set strChkBoxVal End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectSalesAccount ' Input Parameters : strSalesAccount ' Description : This Procedure is used to Select the SalesAccount in the Item Master window. '*************************************************************************** ******* Sub selectSalesAccount(strSalesAccount) If (vbwindow("ItemMaster").VbComboBox("SalesAccount").Exist(20)) then If(vbWindow("ItemMaster").VbComboBox("SalesAccount").GetROProperty("Enabled")=True)Then vbWindow("ItemMaster").VbComboBox("SalesAccount").Select strSalesAccount End If End If End Sub Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential *******

Independent Testing Company

'*************************************************************************** ' Procedure Name : selectPurchaseAccount ' Input Parameters : strPurchaseAct ' Description : This Procedure is used to Select the PurchaseAct in the Item Master window. '*************************************************************************** ******* Sub selectPurchaseAccount(strPurchaseAct) If (vbwindow("ItemMaster").VbComboBox("PurchaseAccount").Exist(20)) Then If (vbwindow("ItemMaster").VbComboBox("PurchaseAccount").GetROProperty("enabled")=True) Then vbwindow("ItemMaster").VbComboBox("PurchaseAccount").Select strPurchaseAct End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectForProcurement ' Input Parameters : strChkBoxValue ' Description : This Procedure is used to Select the ForProcurement in the Item Master window. '*************************************************************************** ******* Sub selectForProcurement(strChkBoxValue) If (vbwindow("ItemMaster").VbCheckBox("ForProcurement").Exist(20)) Then If (vbwindow("ItemMaster").VbCheckBox("ForProcurement").GetROProperty("enabled")=True) Then vbwindow("ItemMaster").VbCheckBox("ForProcurement").Set strChkBoxValue End If End If End Sub '*************************************************************************** ******* ' Procedure Name : setFormsPartOfBOM ' Input Parameters : strChkBoxVal ' Description : This Procedure is used to setFormsPartOfBOM in the Item Master window. '*************************************************************************** ******* Sub setFormsPartOfBOM(strChkBoxVal)

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

If ( vbWindow("ItemMaster").ActiveX("TabsBar").VbCheckBox("Details_FormsAPartOfBOM").Exist( 20)) Then If (vbWindow("ItemMaster").ActiveX("TabsBar").VbCheckBox("Details_FormsAPartOfBOM").GetRO Property("enabled")=True) Then vbWindow("ItemMaster").ActiveX("TabsBar").VbCheckBox("Details_FormsAPartOfB OM").Set "ON" End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectReceivingUnits ' Input Parameters : strRecUnits ' Description : This Procedure is used to Select the Receiving Units in the Item Master window. '*************************************************************************** ******* Sub selectReceivingUnits (strRecUnits) If (vbWindow("ItemMaster").ActiveX("TabsBar").VbComboBox("Details_ReceivingUnits").Exist(20)) Then If (vbWindow("ItemMaster").ActiveX("TabsBar").VbComboBox("Details_ReceivingUnits").GetROPro perty("enabled")=True) Then vbWindow("ItemMaster").ActiveX("TabsBar").VbComboBox("Details_ReceivingUnits").Select strRecUnits End If End If End Sub '*************************************************************************** ******* ' Procedure Name : selectIssuingUnits ' Input Parameters : strIssueUnits ' Description : This Procedure is used to Select the Issuing Units in the Item Master window. '*************************************************************************** ******* Sub selectIssuingUnits (strIssueUnits) If (vbWindow("ItemMaster").ActiveX("TabsBar").VbComboBox("Details_IssuingUnits").Exist(20)) Then

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

If (vbWindow("ItemMaster").ActiveX("TabsBar").VbComboBox("Details_IssuingUnits").GetROProper ty("enabled")=True) Then vbWindow("ItemMaster").ActiveX("TabsBar").VbComboBox("Details_IssuingUnits").Select strIssueUnits End If End If End Sub '*************************************************************************** ******* ' Procedure Name : setPrice ' Input Parameters : strPrice ' Description : This Procedure is used to Set The Price in the Item Master window. '*************************************************************************** ******* Sub setPrice(strPrice) If (vbWindow("ItemMaster").ActiveX("TabsBar").VbEdit("Details_Price").Exist(20)) Then If (vbWindow("ItemMaster").ActiveX("TabsBar").VbEdit("Details_Price").GetROProperty("enabled")= True) Then vbWindow("ItemMaster").ActiveX("TabsBar").VbEdit("Details_Price").Set strPrice End If End If End Sub '*************************************************************************** ******* ' Procedure Name : setLeadTime ' Input Parameters : strLeadTime ' Description : This Procedure is used to set the Lead Time in the Item Master window. '*************************************************************************** ******* Sub setLeadTime(strLeadTime) If (vbWindow("ItemMaster").ActiveX("TabsBar").VbEdit("Details_LeadTime").Exist(20)) Then If (vbWindow("ItemMaster").ActiveX("TabsBar").VbEdit("Details_LeadTime").GetROProperty("enabl ed")=True) Then vbWindow("ItemMaster").ActiveX("TabsBar").VbEdit("Details_LeadTime").Set strLeadTime End If End If End Sub Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential End Class Log File Implementation

Independent Testing Company

Dim s,q,k,a,y,w,e,z,filename Dim objfso Dim objfile s=date k=instr(1,s,"/") If (k>0) Then q=split(s,"/") a=q(1)&"-"&q(0)&"-"&q(2) else a= s End If y=time w=split(y,":") e=split(w(2)," ") z=w(0)&"."&w(1)&e(1) filename=a&"@"&z Set objfso=createobject("scripting.filesystemobject") Set objfile=objfso.createtextfile(LOG_FOLDER&filename&".txt",true) objfile.writeline "This is the logfile generated for Item master " &vbcrlf objfile.writeline "Script executed on "& a & " at " &y &vbcrlf Constants Declaration Declare all the constants in .vbs file and attach it as resources to QTP Test Setting resources. All the other .vbs files paths should be assigned to constants to save it in constants.vbs. This will enable you to execute any .vbs file in driver script. Example: Const ACCEPTEDBY_FINANCE = "FINANCE" Const CHECKBOX_CHECKED = "ON" Const CHECKBOX_UNCHECKED = "OFF" Const SALES_DOMESTIC = "SALES(DOMESTIC)" Const SALES_EXPORTS = "SALES (EXPORTS)" Const UNITS_OF_MEASUREMENT_NOS = "NOS" Const UTILITES_PATH Const APP_PATH Const SOURCE_FOLDER const LOG_FOLDER = = "D:\Syscon Cronus\Utilities\" = "D:\Syscon Cronus\Control\" = "D:\Thatavarti_SysconQTP)\Business Functions\" "D:\Thatavarti_Syscon_Automation(QTP)\Log Files\" Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential const BASE_DRIVE = Const APP_PATH

Independent Testing Company "D:\Thatavarti_Syscon_Automation(QTP)\Generic Functions\" = "D:\Syscon Cronus\Control\"

Driver Script
' Copyright Thatavarti Technologies '**************************************************************************** ************************************************* ' Script Name : Defining An Item In Item Master ' Test Scenario Name : ' Start Date : ' End Date : ' Author : ' Modified By : --NIL-' Modified Date : --NIL-' Reviewed By : ' Reviewed Date : ' Description : ' PseudoCode : '**************************************************************************** ********** 'This statement Ensures that all variables which are used in the script are declared Option Explicit ' ********************************************************************************** ******************************************************** ' Loading of Executable Files ' ********************************************************************************** ******************************************************** ExecuteFile SOURCE_FOLDER & "wndItemMaster.vbs" ExecuteFile SOURCE_FOLDER & "wndMain.vbs" ExecuteFile SOURCE_FOLDER & "wndStoresLogin.vbs" ExecuteFile BASE_DRIVE & "DBConnect.vbs" ExecuteFile BASE_DRIVE & "SysconCleanup.vbs" '**************************************************************************** ************************************************************** ' Declaring the Variables '**************************************************************************** ************************************************************** Dim blnClicked ' boolean value. returns True or False Dim objItemMaster ' object to Item Master Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

Dim objwndMain Dim objwndStoresLogin Dim objCleanup Dim strItemCodeVal Dim strItemVal Dim arrItemCodeVal Dim arrItemVal Dim strLocationVal Dim strGroupVal Dim strClassVal Dim strForSalesVal Dim strSalesAccountVal Dim strFormsBOMVal Dim strReceivingUnitsVal Dim strIssuingUnitsVal Dim strPriceVal Dim strLeadTimeVal Dim objdbConnection Dim blnDBConnected Dim strUserName Dim intNoOfIterations Dim strForProcurementVal Dim strProcureAccountVal Dim intCounter Dim LoopVar '******************************************************************************** ********************************************************** ' Setting the Objects to the Classes '**************************************************************************** ************************************************************** Set objdbConnection = New DBConnect Set objItemMaster = New wndItemMaster Set objwndMain = New wndMain Set objwndStoresLogin= New wndStoresLogin Set objCleanup= New Cleanup '**************************************************************************** ************************************************************** objdbconnection.clearItems '******************************************************************************** ********************************************************** ' Creating Log File '**************************************************************************** ************************************************************** Dim s,q,k,a,y,w,e,z,filename Dim objfso Dim objfile Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

s=date k=instr(1,s,"/") If (k>0) Then q=split(s,"/") a=q(1)&"-"&q(0)&"-"&q(2) else a= s End If y=time w=split(y,":") e=split(w(2)," ") z=w(0)&"."&w(1)&e(1) filename=a&"@"&z Set objfso=createobject("scripting.filesystemobject") Set objfile=objfso.createtextfile(LOG_FOLDER&filename&".txt",true) objfile.writeline "This is the logfile generated for Item master " &vbcrlf objfile.writeline "Script executed on "& a & " at " &y &vbcrlf ' ********************************************************************************** ******************************************************** ' Connecting to the Database ' ********************************************************************************** ******************************************************** blnDBConnected = objdbConnection.getDBConnection() If (blnDBConnected = 1) Then Reporter.ReportEvent micPass,"Connection to the Database","Successfully Connected to the Database" objfile.writeline time &vbtab & "Connection is Established successfully" &vbcrlf Else Reporter.ReportEvent micFail,"Connection to the Database","Failed to Connect to the Database" objfile.writeline time &vbtab & "Connection is not Established successfully" &vbcrlf End If ' ********************************************************************************** ******************************************************** ' Fetching Values from Database ' ********************************************************************************** ******************************************************** strItemCodeVal = objdbConnection.getFieldValue("ItemCode") arrItemCodeVal = Split(strItemCodeVal,",") strItemVal = objdbConnection.getFieldValue("Item") arrItemVal = Split(strItemVal,",") Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

If (UBound(arrItemCodeVal,1) <> 0) Then intNoOfIterations = UBound(arrItemCodeVal,1) If (UBound(arrItemCodeVal,1) <> UBound(arrItemVal,1)) Then ExitRun End If End If strLocationVal = objdbConnection.getFieldValue("Location") strGroupVal = objdbConnection.getFieldValue("Group") strClassVal = objdbConnection.getFieldValue("Classification") strForProcurementVal = objdbConnection.getFieldValue("ForProcurement") strProcureAccountVal = objdbConnection.getFieldValue("PurchaseAccount") strForSalesVal = objdbConnection.getFieldValue("ForSales") strSalesAccountVal = objdbConnection.getFieldValue("SalesAccount") strFormsBOMVal = objdbConnection.getFieldValue("FormsAPartOfBOM") strReceivingUnitsVal = objdbConnection.getFieldValue("ReceivingUnits") strIssuingUnitsVal = objdbConnection.getFieldValue("IssuingUnits") strPriceVal = objdbConnection.getFieldValue("Price") strLeadTimeVal = objdbConnection.getFieldValue("LeadTime") strUserName = objdbConnection.getLoginValue("UserName") ' ********************************************************************************** ******************************************************** ' Launching the Application ' ********************************************************************************** ******************************************************** 'SystemUtil.Run"\\Thatavartihome2\syscon cronus\Control\Shortcutbar.exe" objwndMain.CreateshortCutbar objfile.writeline time &vbtab & "ShortCut Bar Invoked Successfully" &vbcrlf objwndMain.setUserName strUserName objfile.writeline time &vbtab & "User Name Entered successfully" &vbcrlf objfile.writeline time &vbtab & "User Name: " &vbtab & strUserName &vbcrlf blnClicked =objwndMain.clickOK() If(blnClicked=true) Then Reporter.ReportEvent micPass,"Clicking on OK","Successfully Clicked on OK button of Main Window" objfile.writeline time &vbtab & "OK button Clicked successfully" &vbcrlf else Reporter.ReportEvent micFail,"Clicking on OK","Fail to Click on OK button of Main Window" objfile.writeline time &vbtab & "OK button Not Clicked" &vbcrlf End If ' ********************************************************************************** ******************************************************** ' For Clicking On Stores Button In ShortCut Bar and For Logging Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

' ********************************************************************************** ******************************************************** vbwindow("frmShortcutBar").ActiveX("Toolbar").VbToolbar("Toolbar").Press 4 objfile.writeline time &vbtab & "Stores button Clicked successfully" &vbcrlf objwndStoresLogin.setUserName strUserName objfile.writeline time &vbtab & "UserName Entered Successfully" &vbcrlf objfile.writeline time &vbtab & "User Name: " &vbtab & strUserName &vbcrlf vbWindow("StoresLogin").VbEdit("Stores_UserId").Type micReturn vbWindow("StoresLogin").VbEdit("Stores_Password").Type micReturn vbWindow("StoresWindow").Type micCtrlDwn + "m" + micCtrlUp ' ********************************************************************************** ******************************************************** ' For Creating Items In Item Master ' ********************************************************************************** ******************************************************** 'For LoopVar = LOOP_START to LOOP_END For intCounter = 0 To intNoOfIterations objfile.writeline "------------------------------------------------------------------------------" &vbcrlf objItemMaster.setItemCode arrItemCodeVal (intCounter) objfile.writeline time &vbtab & "Item Code Entered" &vbcrlf objfile.writeline time &vbtab & "Item Code: " &vbtab & arrItemCodeVal(intCounter) &vbcrlf 'objItemMaster.setItemCode(strItemCodeVal) 'Wait(3) objItemMaster.setItem arrItemVal (intCounter) objfile.writeline time &vbtab & "Item Name Entered " &vbcrlf objfile.writeline time &vbtab & "Item Name: " &vbtab & arrItemVal(intCounter) &vbcrlf 'objItemMaster.setItem(strItemVal) objItemMaster.selectAcceptedBy ACCEPTEDBY_FINANCE objfile.writeline time &vbtab & "Acceptedby Selected " &vbcrlf objfile.writeline time &vbtab & "Acceptede by : " &vbtab & ACCEPTEDBY_FINANCE &vbcrlf objItemMaster.selectLocation strLocationVal objfile.writeline time &vbtab & "Location Selected" &vbcrlf objfile.writeline time &vbtab & "Location Name: " &vbtab & strLocationVal &vbcrlf wait(5) objItemMaster.selectGroup strGroupVal objfile.writeline time &vbtab & "Group Name Selected" &vbcrlf objfile.writeline time &vbtab & "Group Name: " &vbtab & strGroupVal &vbcrlf objItemMaster.selectClass strClassVal objfile.writeline time &vbtab & "Class Name selected" &vbcrlf Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

objfile.writeline time &vbtab & "Calss Name: " &vbtab & strClassVal &vbcrlf If (intCounter = intNoOfIterations) Then objItemMaster.selectForSales strForSalesVal objfile.writeline time &vbtab & "ForSales Selected" &vbcrlf objfile.writeline time &vbtab & "ForSales: " &vbtab & strForSalesVal &vbcrlf objItemMaster.selectSalesAccount strSalesAccountVal objfile.writeline time &vbtab & "Sales Account Selected" &vbcrlf objfile.writeline time &vbtab & "User Name: " &vbtab & strSalesAccountVal &vbcrlf Else objItemMaster.selectForProcurement strForProcurementVal objfile.writeline time &vbtab & "For Procurement Selected" &vbcrlf objfile.writeline time &vbtab & "For Procurement: " &vbtab & strForProcurementVal &vbcrlf objItemMaster.selectPurchaseAccount strProcureAccountVal objfile.writeline time &vbtab & "Purchase Account Selected" &vbcrlf objfile.writeline time &vbtab & "Purchase Account: " &vbtab & strProcureAccountVal&vbcrlf objItemMaster.setFormsPartOfBOM strFormsBOMVal objfile.writeline time &vbtab & "Part of BOM Selected" &vbcrlf objfile.writeline time &vbtab & "Part of BOM : " &vbtab & strFormsBOMVal &vbcrlf End If objItemMaster.selectReceivingUnits strReceivingUnitsVal objfile.writeline time &vbtab & "Receiving Units Entered" &vbcrlf objfile.writeline time &vbtab & "Receiving Units: " &vbtab & strReceivingUnitsVal &vbcrlf objItemMaster.selectIssuingUnits strIssuingUnitsVal objfile.writeline time &vbtab & "Issuing Units entered" &vbcrlf objfile.writeline time &vbtab & "Issuing Units: " &vbtab & strIssuingUnitsVal &vbcrlf vbWindow("ItemMaster").Type micReturn objItemMaster.setPrice strPriceVal objfile.writeline time &vbtab & "Price Value entered" &vbcrlf objfile.writeline time &vbtab & "Price:" &vbtab & strPriceVal &vbcrlf objItemMaster.setLeadTime strLeadTimeVal objfile.writeline time &vbtab & "LeadTime Eneterd" &vbcrlf objfile.writeline time &vbtab & "Lead Time: " &vbtab & strLeadTimeVal &vbcrlf vbWindow("ItemMaster").Type micAltDwn + "v" + micAltUp vbWindow("ItemMaster").Type micReturn vbWindow("ItemMaster").Type micReturn vbWindow("ItemMaster").Type micF5 Reporter.ReportEvent micPass,"Saving the Item Details","Successfully saved the Item Details" objfile.writeline time &vbtab & "Item Details Saved Successfully" &vbcrlf Next objfile.writeline "------------------------------------------------------------------------------" &vbcrlf Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

'**************************************************************************** ************************************************************** ' For Closing The Item Master window '**************************************************************************** ************************************************************** vbWindow("ItemMaster").Type micF6 Reporter.ReportEvent micPass,"Exiting from the Item Master","Successfully Exited from the Item Master" objfile.writeline time &vbtab & "Item Master Window Closed " &vbcrlf '**************************************************************************** ************************************************************** ' For Closing Stores Window '**************************************************************************** ************************************************************** vbWindow("StoresWindow").Type micF6 Reporter.ReportEvent micPass,"Exiting from the Stores Module","Successfully Exited from the Stores Module" objfile.writeline time &vbtab & "Stores Module Closed " &vbcrlf '**************************************************************************** ************************************************************** ' For Closing Short Cut Bar '**************************************************************************** ************************************************************** VbWindow("frmShortcutBar").ActiveX("Toolbar").VbToolbar("Toolbar").Press 11 objfile.writeline time &vbtab & "ShortCut Bar Closed" &vbcrlf '**************************************************************************** ************************************************************** ' For CleanUp Script '**************************************************************************** ******************************************************************** objcleanup.cleanall objfile.writeline time &vbtab & "Objects De-initialized" &vbcrlf objfile.writeline time &vbtab & "End of Log File" &vbcrlf Set objcleanup = nothing Set objfile = nothing Set objfso = nothing

Descriptive Programming Example


systemutil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe" msgbox Dialog("Title:=Login").Exist(1) msgbox Dialog("Title:=Login").winedit("Title:=Agent Name:").Exist(0) Dialog("Title:=Login").winedit("Title:=Agent Name:").type "fdkj" Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

msgbox Dialog("Title:=Login").winedit("Title:=Password:").Exist(0) Dialog("Title:=Login").winedit("Title:=Agent Name:").type micTab msgbox Dialog("Title:=Login").winedit("Title:=Password:").Exist(0) Dialog("Title:=Login").winedit("Title:=Password:").type "mercury" msgbox Dialog("Title:=Login").WinButton("Title:=Ok").Exist(0) Dialog("Title:=Login").winedit("Title:=Password:").type micTab msgbox Dialog("Title:=Login").WinButton("Title:=Ok").Exist(0) Dialog("Title:=Login").WinButton("Title:=Ok").Click

Calling Re-Usable Action


RunAction "Action1 [Login_Reusable_Action]", oneIteration Window("Flight Reservation").Activate @@ hightlight id_;_4130170_;_script infofile_;_ZIP::ssf1.xml_;_ Window("Flight Reservation").ActiveX("MaskEdBox").Click 0,3 @@ hightlight id_;_4327690_;_script infofile_;_ZIP::ssf2.xml_;_ Window("Flight Reservation").ActiveX("MaskEdBox").Type "111111" @@ hightlight id_;_4327690_;_script infofile_;_ZIP::ssf3.xml_;_ Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt" @@ hightlight id_;_1443352_;_script infofile_;_ZIP::ssf4.xml_;_ Window("Flight Reservation").WinComboBox("Fly To:").Select "Denver" @@ hightlight id_;_2688478_;_script infofile_;_ZIP::ssf5.xml_;_ Window("Flight Reservation").WinButton("FLIGHT").Click @@ hightlight id_;_1574440_;_script infofile_;_ZIP::ssf6.xml_;_ Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "20122 FRA 08:00 AM DEN 08:45 AM SR $163.00" @@ hightlight id_;_1050876_;_script infofile_;_ZIP::ssf7.xml_;_ Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click @@ hightlight id_;_6621024_;_script infofile_;_ZIP::ssf8.xml_;_ Window("Flight Reservation").WinEdit("Name:").Set "raju" @@ hightlight id_;_5769156_;_script infofile_;_ZIP::ssf9.xml_;_ Window("Flight Reservation").WinButton("Insert Order").Click @@ hightlight id_;_5834586_;_script infofile_;_ZIP::ssf10.xml_;_ Window("Flight Reservation").Activate @@ hightlight id_;_4130170_;_script infofile_;_ZIP::ssf11.xml_;_ Window("Flight Reservation").Close

Copy of Action
RunAction "Copy of Action1", oneIteration Window("Flight Reservation").Activate @@ hightlight id_;_3409164_;_script infofile_;_ZIP::ssf1.xml_;_

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

Window("Flight Reservation").ActiveX("MaskEdBox").Type "1111111" @@ hightlight id_;_1640756_;_script infofile_;_ZIP::ssf2.xml_;_ Window("Flight Reservation").WinComboBox("Fly From:").Select "London" @@ hightlight id_;_4851048_;_script infofile_;_ZIP::ssf3.xml_;_ Window("Flight Reservation").WinComboBox("Fly To:").Select "Denver" @@ hightlight id_;_3933662_;_script infofile_;_ZIP::ssf4.xml_;_ Window("Flight Reservation").WinButton("FLIGHT").Click @@ hightlight id_;_3999208_;_script infofile_;_ZIP::ssf5.xml_;_ Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click @@ hightlight id_;_3344122_;_script infofile_;_ZIP::ssf6.xml_;_ Window("Flight Reservation").Activate @@ hightlight id_;_3409164_;_script infofile_;_ZIP::ssf7.xml_;_ Window("Flight Reservation").WinEdit("Name:").Set "chandu" @@ hightlight id_;_6358788_;_script infofile_;_ZIP::ssf8.xml_;_ Window("Flight Reservation").WinButton("Insert Order").Click @@ hightlight id_;_8652608_;_script infofile_;_ZIP::ssf9.xml_;_ Window("Flight Reservation").Activate @@ hightlight id_;_3409164_;_script infofile_;_ZIP::ssf10.xml_;_ Window("Flight Reservation").Close

Optional Step
Optional Step Def : If the specified object is not existing it will ignore and forward to the next step. SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open" Dialog("Login").WinEdit("Agent Name:").Set "chandu" @@ hightlight id_;_4589556_;_script infofile_;_ZIP::ssf1.xml_;_ Dialog("Login").WinEdit("Password:").SetSecure "44c9ad1be59f087ea70d531a3abde65f322da5b3" @@ hightlight id_;_1443596_;_script infofile_;_ZIP::ssf2.xml_;_ msgbox " <Ok> Button is optional " wait(5) OptionalStep.Dialog("Login").WinButton("OK").Click @@ hightlight id_;_4982622_;_script infofile_;_ZIP::ssf3.xml_;_ 'Dialog("Login").WinButton("OK").Click

Excel Interaction
Set obj=createobject("excel.application") do For i=5 to 7 'i=5

Thatavartis Training Unit School of Software Testing

Thatavarti Technologies Pvt Ltd Confidential

Independent Testing Company

systemutil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4b.exe" obj.workbooks.open"C:\Documents and Settings\Administrator.THATAVARTIHYD\Desktop\Excel_Login.xls" var1=obj.activesheet.cells(i,1) var2=obj.activesheet.cells(i,2) Dialog("Login").WinEdit("Agent Name:").Set var1 'wait 2 Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure var2 'wait 2 Dialog("Login").WinEdit("Password:").Type micReturn Window("Flight Reservation").Close 'i=i+1 If dialog("Login").Dialog("Flight Reservations").Exist Then recovery.Activate End If Next loop until obj.activesheet.cells(8,1)="hari" set obj=nothing

********** The End **********

Thatavartis Training Unit School of Software Testing

Das könnte Ihnen auch gefallen