Action Template:-
In our test, in every new action, if we want to include one or more statements like Headers (Author name, Creation date, Change log etc...), function calls, etc... We can create an action template(Text file) with these statements. Save it as ActionTemplate.mst in below path in local machine.
Path:- QuickTestInstallation Folder\dat folder.
Note: QTP identifying only the file name ActionTemplate.mst is recognized as an action template.
Thursday, January 22, 2009
Wednesday, January 21, 2009
Methods for Retrive Data from DB Query result
Number of Columns in DB Query Results :-
Column count= Fields.Count
Number of in DB Query Results :-
Record/Row count= RecordSet.recordcount
Get the Column value from a particualr Record :-
value= RecordSet.Fields(Index of the Column).Value
How to confirm DB (Database) connection is successfully connected?
Return value= RecordSetObjectName.State
0-- Zero represents for NOT connected successfull
1-- One represents for Successfull connection.
Sometimes Data base columns we have cast for capture values. we can do same with below query.
Select Cast(filed name as nVarchar(3000)) from table name where condition
Column count= Fields.Count
Number of in DB Query Results :-
Record/Row count= RecordSet.recordcount
Get the Column value from a particualr Record :-
value= RecordSet.Fields(Index of the Column).Value
How to confirm DB (Database) connection is successfully connected?
Return value= RecordSetObjectName.State
0-- Zero represents for NOT connected successfull
1-- One represents for Successfull connection.
Sometimes Data base columns we have cast for capture values. we can do same with below query.
Select Cast(filed name as nVarchar(3000)) from table name where condition
Labels:
DataBase Automation
XML file creation
Set objXML = CreateObject ("Microsoft.XMLDOM")
'Create our root element using the createElement method
Set objXML.documentElement = objXML.createElement("SourceNode")
'Create Element and Node
Set objsrcl = objXML.createElement ("FirstNameAttribute") objXML.documentElement.appendChild objsrcl.cloneNode(true)
Set Node = objXML.documentElement.selectSingleNode("FirstNameAttribute")
' Create Attributes and assign values
Node.setAttribute "FirstNameAttribute", " Value"
Node.setAttribute "Second", "Value"
Node.setAttribute "third", "Value"
Node.setAttribute "Fourth","Value"
Node.setAttribute "Site", "Site"
'Save the file as XML
objxml.save "C:\CreatedXML.XML"
'Create our root element using the createElement method
Set objXML.documentElement = objXML.createElement("SourceNode")
'Create Element and Node
Set objsrcl = objXML.createElement ("FirstNameAttribute") objXML.documentElement.appendChild objsrcl.cloneNode(true)
Set Node = objXML.documentElement.selectSingleNode("FirstNameAttribute")
' Create Attributes and assign values
Node.setAttribute "FirstNameAttribute", " Value"
Node.setAttribute "Second", "Value"
Node.setAttribute "third", "Value"
Node.setAttribute "Fourth","Value"
Node.setAttribute "Site", "Site"
'Save the file as XML
objxml.save "C:\CreatedXML.XML"
Labels:
XML Automation
How to Count and close all open Browsers?
' Create description for Browser
Set strBrowser=Description.Create
strBrowser("micclass").value="Browser"
Set strBrowserObject=Desktop.ChildObjects(strBrowser)
' get the Open browsers count
BrowserCnt=strBrowserObject.count
For i=0 to BrowserCnt-1
' Get the open browsers name
BrowserName=strBrowserObject(i).getroproperty("name")
' close the open browser
strBrowserObject(i).Close
Next
Set strBrowser=Description.Create
strBrowser("micclass").value="Browser"
Set strBrowserObject=Desktop.ChildObjects(strBrowser)
' get the Open browsers count
BrowserCnt=strBrowserObject.count
For i=0 to BrowserCnt-1
' Get the open browsers name
BrowserName=strBrowserObject(i).getroproperty("name")
' close the open browser
strBrowserObject(i).Close
Next
Labels:
General
How to split a text based on end of line?
Use Split function with "VbCrLf" Constraint, see the below code snippet.
text= enter text, which is having with End of line
Split(Text, VbCrLf)
text= enter text, which is having with End of line
Split(Text, VbCrLf)
Labels:
General
Subscribe to:
Posts (Atom)