Vous êtes sur la page 1sur 1

String QTP Quick Reference Card v1.

1 Constants
Asc Free available at http://automated-chaos.blogspot.com Created by Bas M. Dam Empty
Chr Nothing
Filter File System Object: Set fso = CreateObject("Scripting.FileSystemObject") Null
InStr set ts = fso.CreateTextFile(Filename [, blnOverwrite]) vbCr
InStrRev set f = fso.OpenTextFile(Filename [, IOmode]) TextStreamObject FileObject vbCrLf
LCase set f= fso.GetFile(Filename) ts.Read(nCharacters) f.Copy(strDestination) vbLf
Left fso.CopyFile strSource, strDestination ts.ReadLine f.Move(strDestination) vbNewLine
Len fso.DeleteFile(Filename) IO Modes ts.ReadAll f.Delete vbNullChar
LTrim fso.FileExists(Filename) 1 - Reading ts.Write strText f.Name vbNullString
Mid fso.MoveFile strSource, strDestination 2 - Writing ts.WriteLine strText f.Path vbTab
Replace fso.GetFileName 8 - Appending ts.Close f.Size vbTextCompare
Right vbBinaryCompare
RTrim Dictionary: Set dict = CreateObject("Scripting.Dictionary") Use of Classes in QTP
Space dict.Add Key, Item Class Classname Type Check
String dict.Remove(Key) Private Sub Class_Initialize() IsArray
StrReverse dict.RemoveAll Set re = New RegExp Private Sub Class_Terminate() IsDate
Trim dict.Exists(Key) re.Pattern strPatrn Public {variable|Function|Sub|Property} IsEmpty
UCase dict.Count re.Test(strText) Private {variable|Function|Sub|Property} IsNull
dict.Keys re.Execute(strText) Property Get propName IsNumeric
Arrays dict.Items re.Replace(Text, ReplaceText) Property Let propName(NewValue) IsObject
Array Property Set propName(Reference) TypeName
Erase QTP Object Wrapper End Class VarType
Join Set MyEdit = Browser(x).Page(y).WebEdit(z) To use a class in a different library,
Lbound MyEdit.Set LoginName include thie following function in the same Conversion
Redim [Preserve] library as where the class is located: Abs
Split QTP Description Object Error Object Fix
Ubound set Desc = Description.Create() Err.Raise Public Function NewClassname() Int
Desc(strProperty).Value Err.Clear Set NewClassname = New Classname Round
Date Time Desc.Count Err.Description End Function Sgn
Date Desc.Remove strProperty Err.Number Method to use this class in another lib:
DateAdd Desc.RegularExpression Err.Source Set CustObject = NewClassname Math
DateDiff Exp
DatePart XMLUtil Object SystemUtil Object Log
Day XMLUtil.CreateXML() returns a XMLData Object SystemUtil.Run FileName Rnd
FormatDateTime XMLDataObj.LoadFile Filename SystemUtil.BlockInput Sqr
Hour XMLDataObj.GetRootElement() returns a XMLElement Object SystemUtil.UnblockInput Sin
Minute XMLElement.ChildElements() SystemUtil.CloseProcessByName(Proc) Tan
Month XMLElement.AddAttribute strName, strValue Atn
Now XMLElement.AddChildElement(objChildElement) QTP Timer Object Cos
Second XMLElement.NextSibling() MercuryTimers(VarTimer).Start RandomNumber
Time XMLElement.Parent() MercuryTimers(VarTimer).Stop
Weekday XMLElement.SetValue(strValue) MercuryTimers(VarTimer).Continue Arithmetic
WeekdayName XMLElement.Value() MercuryTimers(VarTimer).ElapsedTime Concat &
Year XMLElement.ElementName() MercuryTimers(VarTimer).Reset Substract -
Sum +
Formatting Conditional Statements Services Object Multiply *
FormatCurrency If condition Then Select Case expression Services.StartTransaction Division /
FormatDateTime statement Case expressionlist Services.EndTransaction Div. to Int \
FormatNumber ElseIf condition Then statement Services.LogMessage Power ^
FormatPercent statement Case Else expressionlist Modulus Mod
Else statement Loops
Type statement End Select For counter = start To end Step step Notation
CBool End If statement Hex
CByte Exit For Oct
CCur Functions and Subs statement
CDate [Public [Default] | Private] Function name [(arglist )] Next Compare
CDbl statement <
CInt name = expression For Each element In group <=
CLng Exit Function statement >
CSng statement Exit For >=
CStr End Function statement =
Next element <>
Environment.Value(p) [Public [Default] | Private] Sub name [(arglist )]
ActionIteration statement Do [{While|Until} condition ] Logic
ControllerHostName Exit Sub statement And
GroupName statement Exit Do Or
LocalHostName End Sub statement Not
OS Loop [{While | Until} condition ] Xor
OSVersion arglist: Only one While or Until is allowed
ProductDir [ByRef | ByVal] variable Execution
ProductName ByRef is the reference (pointer), ByVal makes a local copy. QTP Messaging Call
ResultDir MsgBox Prompt, Button, Title Eval
ScenarioId QTP DataTable Object Print "Message" Execute
SystemTempDir DataTable.Import(Filename) InputBox Promt, Title, Default ExecuteFile
TestDir DataTable.Export(Filename) Reporter.ReportEvent MicType, "Step", "Msg" ExitTest
TestIteration DataTable.AddSheet(SheetName) Services.LogMessage "Msg", Level ExitTestIteration
TestName DataTable.Value(ParamID, SheetID) Wait
UpdatingActiveScreen DataTable.RawValue(ParamID, SheetID) With Statement
UpdatingCheckpoints DataTable.SetCurrentRow(RowNr) With Browser("Welcome").Page("Home") Control
UpdatingTODescriptions DataTable.SetNextRow Constants for SheetID .Sync Option Explicit
UserName DataTable.GetCurrentRow dtLocalSheet .WebEdit("Login").Set LoginName Randomize
VuserId DataTable.GetRowCount dtGlobalSheet End With Extern.Declare

Vous aimerez peut-être aussi