Tuesday 11 February 2014

Basic Required methods in TestComplete. Part - 1

Deal All,

In this blog I am going to explain basic required methods in TestComplete along with syntax of that methods in VBScript.

1- Subroutine : - Subroutine is a series of statement enclosed by Sub and End Sub Statement, Subroutine performed action but does not return any value.
Syntax -

              Sub yourRoutineName
                  Statement 1 
                  Statement 2

                   Statement n 
               End Sub

2- Function : - Function is a series of statement enclosed by Function and End Function Statement, Function performed action and it can return the value. it take arguments that are passed to it by a calling procedure.
Syntax - 

        Function yourFunctionName()                Function FunctionName(arr1, arg2..argN)
            Statement 1                                                   Statement 1
            Statement 2                                                   Statement 2

             Statement n                                                    Statement n
        End Function                                              End Function                             

3- Variable : - Variable is a place holder it is used for storing information. In VBScript we can declare variable by using Dim Statement.
Syntax -

         Dim VariableName

4- CreateObject : - This function is used to create Object of any application/class
Syntax - 

        Set objName = CreateObject ("application.Class")
        Set objNotepad = CreateObject("Scripting.FileSystemObject")
        Set objExcel = CreateObject("Excel.Application")   

5- Message Box : - Display message/ information in a dialog box, message box wait till used does not click on OK button.
Syntax - 
        msgBox("Your Message/Information")

6 - Input Box : - InputBox is used to get the values from the user. After entering the values, if the user clicks the OK button or presses ENTER then InputBox function will return the text in the text box. If the user clicks on the Cancel button, the function will return an empty string ("").
Syntax - 

       inputText  = InputBox("YourMessage/Information")

7- SetText : - SetText method is used to entered text in a specific location like- Edit box, Password box, TextArea, or any text editor.
Syntax -

TestObj.SetText("YourText/values")                                                                       

8 - Keys :- The Keys action sends keyboard input to the object, it is used to simulate keyboard stroke on the object, we can simulate 1- Alphabet, 2- Number, 3- Hot keys, 4- Function keys etc,
Syntax - 

       TestObj.Keys("[Up]")
       TestObj.Keys("Your Text") etc....

9 -Click : - This method is used to click mouse button on the object
Syntax - 

       TestObj.Click()  or TestObj.Click

10 - Delay() :-Delays the script execution for the specified time period, Delays the script execution for xxxx. milliseconds
Syntax -  

      Delay(TimeInterval) like Delay(500)

No comments:

Post a Comment