Top 10 Test Automation Tools 2023!

What is an automation tool?

An automation tool is a software application that is used to automate tasks. Automation tools can be used to automate a variety of tasks, including:

* Test automation

* Deployment automation

* Business process automation

* IT operations automation

Why use an automation tool?

There are many reasons to use an automation tool. Some of the benefits of using an automation tool include:

* Increased productivity

* Reduced errors

* Improved quality

* Increased compliance

* Reduced costs

Types of automation tools

There are many different types of automation tools available. Some of the most common types of automation tools include:

* Test automation tools

* Deployment automation tools

* Business process automation tools

* IT operations automation tools

Choosing an automation tool

When choosing an automation tool, it is important to consider the following factors:

* The type of tasks you need to automate

* The size and complexity of your project

* Your budget

* Your team's experience with automation tools

Top 10 automation tools:

Here are the top 10 automation tools:

Top 10 Automation Tools 2023

01. Selenium:

Selenium is a free and open-source automation tool that is used to automate web applications. Selenium is a popular choice for web application testing because it is easy to use and there are a large number of resources available to help you get started.

Selenium can be downloaded from their official website 

2. Appium

Appium is an open-source automation tool that is used to automate mobile applications. Appium supports a variety of mobile platforms, including Android, iOS, and Windows Phone. Appium is a popular choice for mobile application testing because it is easy to use and there are a large number of resources available to help you get started.

Appium can be downloaded from this website.

3. Katalon Studio

Katalon Studio is a commercial automation tool that is used to automate web and mobile applications. Katalon Studio is a popular choice for automation testing because it is easy to use and it supports a variety of programming languages, including Java, Python, and C#.

Katalon Studio can be downloaded from this website.

4. Cucumber

Cucumber is a behavior-driven development (BDD) tool that is used to automate acceptance tests. Cucumber is a popular choice for acceptance testing because it is easy to use and it allows you to write tests in plain English.

Cucumber can be downloaded from this wesbite.

5. HPE Unified Functional Testing (UFT)

HPE Unified Functional Testing (UFT) is a commercial automation tool that is used to automate desktop, web, and mobile applications. UFT is a popular choice for automation testing because it is a comprehensive tool that supports a variety of features, including scripting, data-driven testing, and reporting.

UFT can be downloaded from this website.

6. Tosca

Tosca is a commercial automation tool that is used to automate business processes. Tosca is a popular choice for automation testing because it is a comprehensive tool that supports a variety of features, including scripting, data-driven testing, and reporting.

UFT can be downloaded from this website.

7. TestComplete

TestComplete is a commercial automation tool that is used to automate desktop, web, and mobile applications. TestComplete is a popular choice for automation testing because it is a comprehensive tool that supports a variety of features, including scripting, data-driven testing, and reporting.

TestComplete trial version can be downloaded from this website.

8. Cypress

Cypress is a new open-source automation tool that is used to automate web applications. Cypress is a popular choice for automation testing because it is easy to use and it provides a real-time, interactive experience for testers.

Cypress can be downloaded from this website.

9. IBM Rational Functional Tester (RFT)

IBM Rational Functional Tester (RFT) is a commercial automation tool that is used to automate desktop, web, and mobile applications. RFT is a popular choice for automation testing because it is a comprehensive tool that supports a variety of features, including scripting, data-driven testing, and reporting.

RFT can be downloaded from this website.

10. Karate

Karate is a new open-source automation tool that is used to automate API testing. Karate is a popular choice for API testing because it is easy to use and it supports a variety of programming languages, including Java, Python, and C#.

Karate tool can be downloaded from this website.

Conclusion

These are just a few of the many automation tools that are available. The best tool for you will depend on your specific needs and requirements. It is important to evaluate several tools before making a decision.

Content Courtesy: Bard

QTP Interview Questions - Part 1 !!!





[1]. Which environments are supported by QTP?

    QTP supports the following environments.


  • Active X 
  • People Soft
  • Terminal Emulator
  • Java
  • Siebel
  • .Net
  • Web
  • Visual Basic
  • SAP
  • Web Services
  • Visual Age
  • Oracle
  • Stingray
  • Power Builder


[2]. What are the Object Repositories supported by QTP?

QTP supports 2 types of Object Repositories.

01.Local Object Repository/ Per Action Object Repository

Local object repository is used by default. The file extension of local object repository is ".mtr"

02.Shared/ Global Object Repository:

Shared object repository is preferable while dealing with dynamic objects which are called in multiple tests. The file extension of shared object repository is ".tsr".

[3]. Can we call QTP test from another test using scripting?

Yes. We can call QTP test from another Test using scripting. To do this, we need to make the actions in the corresponding scripts re-usable. Then we can make call from the destination script.

[4]. What is action split and the purpose of using this in QTP?

Action split is used to divide the selected action into 2 parts. The main purpose of dividing the action to improve code re-use.

[5]. How QTP identifies Object?

QTP identifies any GUI object based on its corresponding properties. While recording, QTP will identify and store peculiar properties as defined in Object identification Settings[i.e., mandatory and assistive properties] in the object repository of GUI object.

QTP will compare the stored property values against the on-screen object property values, to uniquely identify the GUI during Run Time.

Features Of Latest Version Of QTP/UFT 12.1!!!

The latest version of QTP/UFT(Unified Functional Testing) is 12.1. It supports the following.
                                        
                                                
  • OS:
  1.  Latest version of QTP supports Windows 8.1 and Windows Server 2012.
  1.   Supports Safari browser.
  • UFT Extension:
  1. UFT extension in chrome receives updates Automatically on Chrome.
  • Support For Run Time Application:
  1. Records and run Tests on Windows Run Time Application.
  1. Create Object Repositories with Windows Run Time Application.
  • Newly Supported Technologies:
  1. JDK 1.8
  1. XenDesktop 7
  1. SAP Web Dynapro
  • Extended Support For Other Technologies:
  1. Object identification and interaction with Siebel Web Applications, SAP Applications.
  1. New FlexTable Test Object methods available for advanced data grid controls.

QTP: Working with Local, Shared Object Repositories

As we know the object repositories can be associated with any Action in anyone of the following combination(s).

  •          Local Object Repository
  •          Shared Object Repository
  •          Local + one or more Shared Object Repositories
  •          Two or more shared object Repositories.



So, there are possibilities of conflict situation when the object with the same name is present in two or more repositories. To avoid the confusion, the following points to be remembered to avoid the confusion.

·      Scenario#01: Action is associated with Local + Shared Object Repositories, Object is not present in both the repositories.

Result: QTP will add objects to the Local object repository ONLY.
·        
     Scenario#02: Action is associated with Local + Shared Object Repositories, Object is present in either of 2 repositories.

Result: QTP will not add any object. Instead of this, QTP will use the existing information.
·      
       Scenario#03: Action is associated with Local + Shared Object Repositories, Newly added Object’s Parent in Shared Object Repository.

Result: QTP will move the parent to the Local object repository when the child is added to the Local repository.
Source: QTP Documentation.

How to Create a Word Document in QTP?

Dim oWord

'Initiate the word document object

Set oWord = CreateObject("Word.Application")

'Create new word document
oWord.Documents.Add

'Type some characters in the newly created document
oWord.Selection.TypeText "Dhana Test Text"
 

'Save the document
oWord.ActiveDocument.SaveAs "c:\Dhana\Test.Doc
 

'Close word
oWord.Quit

'Release the object
Set oWord = Nothing

Accessing Forms in WebDriver Part-1

In this article, we are going to learn, how the WebDriver access the forms.

As we know that the forms contains different elements such as Radio Button,Checkbox,Text/Input Box,Drop-Down List, Links etc. We are going learn, how the WebDriver access all these elements in this article.

Links:
Links are accessed by using the click() method.


Example:Consider the following link found in Yahoo home page.

           
We can access the link using "LinkText()" or "PartialLinkText()" with the combination of "click()" method. We can use either of the following 2 lines to access the "SIGN IN" link marked above.

PartialLinkText() method:
driver.FindElement(By.PartialLinkText("SIGN")).Click();
 
LinkText() method:
driver.FindElement(By.LinkText("SIGN IN")).Click();

Radio Button:
Radio Button can also be toggled using click() method.

Example:Consider the following Radio buttons.
                               
We can toggle anyone of the above shown radio button using click method.The following code snippet toggle the Red radiobutton option.

driver.FindElement(By.CssSelector("input['value=Red']")).Click();

Input Box:
Input Box refers either of the following 2 types of fileds.
  •  Text Fields: Text fields accepts the values typed by the user and shows as it is.[Ex:Username field in login screen.]
  • Password fields: Password fields also accepts the values typed by the user and displays in encrypted format to maintain the security as the password is a sensitive from user's point of view. 
 The following picture depicts the Text and Password fields.
                 

Entering values in Input Box:
We can enter values in the Input Box by using SendKeys() method.

Code:
driver.FindElement(By.Name("Username")).SendKeys("test");
The above code will type the text "test" in Username field.

Deleting the values from Input Box:
We can delete values from the Input Box by using clear() method.

Code:
driver.FindElement(By.Name("Username")).clear();
The above code will clear the text "test" from Username field.

Descriptive Programming In QTP

This article provides the details about:
  • Introduction to Descriptive Programming 
  •  Advantages of Descriptive Programming
  • Writing Descriptive Programming
  • When and Where to use the Descriptive Programming
  • Points to note with Descriptive Programming

Introduction to Descriptive Programming:
Descriptive programming is mainly used to perform the actions on objects which are not present in the object repository or we can simply tell that the entering/providing the object information directly into the test script is called Descriptive Programming.

Advantages of Descriptive Programming:
01.Maintenance is easy as the resources are less.
02.Script are portable as we can run the scripts from any machine.
03.We can start the test execution process before the application is ready.

Wring Descriptive Programming:
We have 2 ways to write the Descriptive programs.

01.Static Programming / Giving the description in the form of string arguments.
02.Dynamic Programming / Creating properties collection object for the description.

01.Static Programming:
This is most commonly used method in which the object description is directly passed into the script by specifying the "property:=value" pairs.It directly describes the object instead of specifying an object's name.
 

Syntax:TestObject("PropertyName1:=PropertyValue1","....","PropertyNameX:=PropertyValueX")

Example:
InvokeApplication "c:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "STC"
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure password
Dialog("text:=Login").WinButton("text=Login").Click

Note:
Dialog,WinEdit,WinButton  - Test objects
text, attached text - Property Names
Login,Agent Name:, Password:, - Property Values - Represents the logical names of the objects

If we feel that the property information is not sufficient to identify the object uniquely we can add more property information.If we want to get the object names we can use object spy feature which is present in the object repository manager.
If we want to maintain the objects information in a centralized location then we can use Constants.
Example:
Const Login="text:=Login",Agent ="attached text:=Agent Name:"
Const Pwd ="attached text:=Password:", WBut ="text:=OK"

Note:We can declare n-number of contants in a single line separated by comma(,). But we need to use the word Const if we are going for a new line.

Creating Library:
01.Copy the above declared constants to a notepad and save it as a .vbs file.
02.Associate the vbs file to File> Settings> Resource> Click (+) icon> Browse the path of the vbs file and select the vbs file and then click on Apply, OK buttons or the library file can be loaded dynamically.

Syntax: ExecuteFile "path of the vbs file"
Example Of Creating Script using constants:
InvokeApplication("c:\Program Files\HP\QuickTest Professional\
Dialog(Login).Activate
Dialog(Login).WebEdit(Agent).Set "STC"
Dialog(Login).WebEdit(Pwd).SetSecure password
Dialog(Login).WinButton(OK)

Advantages of the static programming: The main advantage of using library in static programming is that the changes can be easily done as the variable are declared in a common location.

02.Dynamic Programming:
This is also similar to the static programming. But the only difference is that it collects all the properties of a particular object in an instance of that object.By using that the object can be referenced easily by using the instance instead of the string arguments.

Steps:
01.Create the description of the object.
Syntax:Set Variable=Description.Creare
Ex: Set Login = Description.Create
02.Enter properties information into the description of the object.
Syntax: Variable("Property Name").value ="Property Value"
Ex:Login("text").value = "Login"
03.Generating statements using description objects
Syntax:TestObject(Description Object").Method
Ex:Dialog(Login).Activate

Creating propeties Collection Of Objects:
Set oLogin = Description.Create
Set oPassword = Description.Create
Set oUname = Description.Createc
Set oOK = Descrption.Creae

Enter the properties information into objetcs:
oUname("attached text").value="Agent Name:"
oPassword("attached text').value ="Password:"
oOK("text").value="OK"

Generating Tests using properties collection objects:
InvokeApplication "c:\Program Files\ HP\ QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog(oLogin).activate
Dialog(oLogin).WinEdit(oUname).Set "STC"
Dialog(oLogin).WinEdit(oPassword).SetSecure password
Dialog(oLogin).WinButton(oOK).click
 

We can create the library files like static programming by following the below mentioned steps.

01.Create description objects and put into one library, by associating that library file,we can generate tests.
02.Dynamic programming is little bit difficult in preparation that the static programming but maintenance is easy.

QTP Settings Global Configuration

This article explains the details about the object identification and configuration.
 

As we know that there are around 25-30 object properties are available for each object in QTP. But QTP recognizes them by using only 2 to 3 properties.

By default QTP has certain configuration for each environment. We can add more properties if we feel that the default properties are not enough to identify the object.

In this article am going to explain the various object identification configurations available in QTP.

01.Normal Identification:
In this type of configuration,QTP uses two types properties to identify the object uniquely.
   a. Mandatory Properties
   b. Assistive Properties
In this configuration,QTP learns all mandatory properties at a time and thinks whether these properties are sufficient to identify the object uniquely. If it feels the properties are sufficient to identify the object uniquely then it stops learning.Otherwise,it learns the first assistive property once and stops and thinks and keep on repeating the steps until the object is uniquely identified.At the end of the assistive properties if QTP feels that the properties are not sufficient it finally goes to Ordinal Identifier.

02.Smart Identification:
In this type of configuration, QTP uses two types of properties to identify the object uniquely.
  a.Base filter properties
  b.Optional properties
This is an optional configuration.If we feel that the normal configuration is not enough to identify the object we can go for Smart Identification configuration. In this QTP learns all base filter properties at a time and thinks whether the properties are sufficient to recognize the object uniquely.If QTP feels the properties are sufficient then it stop learning.Otherwise, it goes to the optional filter properties and learns one by one.Then QTP keep on repeating the same step if it feel the properties are not sufficient. At the end of the assistive properties if QTP feels that the properties are not sufficient it finally goes to ordinal identifier.

03.Ordinal Identifiers:

We have 3 types of Ordinal Identifiers in QTP.
   a.Index
   b.Creation Time
   c.Location

Index: This one is based on the sequence of the programs. It starts from Zero.
Creation Time:This one is based on the loading time of the web objects.It starts from Zero.
Location: This one is based on the object location on the AUT. It starts from Zero.

Settings:
Since QTP is a stand alone application, it's is not possible to configure the settings as Global. But QTP is providing a feature called "Generate Script" to configure the settings as Global.
 

01.The settings are available in 3 areas.
    a.File> Settings
    b.Tools> Options
    c.Tools> Object Identification
02.Configure the required settings and generate scripts.
03.The script should be stored in VBS format and shared with the team members.
04.Launch the generated script across n-number of PCs to get the same settings.

How to record a script in QTP?

This article explains the steps to be followed to record a script in QTP. Recording script in QTP is very useful for the beginners. We have to follow a certain steps to record a script.

01.Launch the QTP tool.
02.Click on Record button or Press F3 on QTP tool and observe that a pop up window is opened. This window will be opened automatically whenever the "Record" button is pressed.
03.Observe that the pop up window is opened with "Record and Run Settings" tab for each environment based on the add in configured/selected.
  Assume that we have Oracle, SAP add ins are configured along with the default Windows and Web environments.So, the pop up will be opened with Record and Run Settings tabs for Web,Windows, Oracle and SAP environments provided that the add ins are loaded when QTP launched.
04.For any environment the record and run settings are classified into two generic groups.


  • Record and Run on ANY window belonging to the particular environment.
  • Record and Run on a SPECIFIC window belonging to the particular environment. This option is recommended.
05. QTP will remember the settings for the entire record session until the record settings are manually changed by the Automation Engineer.
06.Click on "OK" button and observe that the disclaimer is updated as "Recording" in right bottom of the QTP tool bar.
07. Then launch the application to which the script to be recorded.Perform some action on the application and observe that the script is recorded in the form of VBScript in Expert View and in the form of Object Tables in Keyword view.
08.Once the action is performed on the Application just press on "Stop" or "F4" button and observe that the script recording is stopped.
09.Then Save the script.
10.Playback and check the script to make sure that the script is rerunning without any issue.





Insert Call To Existing Action in QTP

This article explains the details about the call to existing action in QTP. We can insert call to the existing/ reusable action stored in the current test or stored in external test. The action will be copied to the current test in read only format. We can view the steps of the action in action view, but we can't modify them.

The called action's object repository is also read only.If the called action has data in the Data Table,we can select whether we want the data from the action's data sheet to be imported as local,editable or read only from the original action.But the columns and data from the called action's global date sheet is always imported into the calling test as a local, editable copy.

Assume that we need to modify the called external action. TO to this, we need to open the original action from the test in which it resides and make the necessary changes. This modifications will be reflected in all the tests which are call that action. If we use the original action's data when you call an external action,then the changes made to the original action's data are applied as well.

Note: We can view the location of the original action in the General tab of the action properties dialog box.

Steps to be followed to insert a call to an existing action:

01.Navigate to Insert> Call To Existing Action from Expert/Keyword view or right click at any step> Action> Insert Call To Existing.
02.Observe that a window is opened with a combo boxes named as From and Action.
03.From combo box represents the list of tests which contains the resalable action.
04.We can select some other actions by using the browse button which is located just adjacent to From combo box.
05.Action combo box displays all reusable actions in the test we selected.
06.Assume that we selected any one of the action.When we select the action, its type(Reusable Action) and description,if one exists, are displayed.It'll be helpful for us to identify the action you want to call.

Note:External actions that the test calls are also displayed in the list.If the action we want to call is already called from within the selected test,we can select it from the list of actions.This creates another call to the original action.

07.Next step is to decide the insertion place. We can insert either at the end of the test or after the current step.

08.Click on OK button and observe that the action is inserted into the test flow. We can move our action call to another location in our test by dragging it to the desired location.

Note:We can create an additional call to any reusable or external action in our test by pressing Ctrl while you drag and drop the action to another location at a parallel (sibling) level within your test scripts.

Call To Copy Of Action in QTP

 
This article explains about the call to copy of action and the steps to be followed.
 
We need to remember the following points when using "Call To Copy Of Action" in QTP.

01.When we insert call to copy of an action in a test, the original action is completely copied to the current test.

02.Complete action represents the various checkpoint, parameters, copied actions data table and any defined parameters.

03.If the copied action has objects in Local Object repository, the copied action's local object repository is also copied with the action.

04.The copied action is inserted to the current test as an independent.

05.The copied action will be non reusable even though the original action was reusable.

06.Once the action is copied to the current test, we can perform the operations like add, modify and delete.

07.Changes made to the copied action will not have any impact on the original actions and also the changes made to the actual action will not have any impact on the copied action.

Steps to create a copy of an action:

We need to follow certain steps to copy the action to current test.

01.Make sure that the selected Test is opened.[Ex: Test1].
02.We can navigate to the insert call to copy option by using any one of the following step.

    Method#01: Navigate to Insert> Call To Copy of Action.
    Method#02: Navigate to Keyword view> Selection the Action>Right Click> Insert Call to copy of action.
    Method#03: Navigate to Keyword view> Selection the Action>Right Click> Action> Insert Call to copy of action.

03.A window will be opened once the option "Insert Call To Copy Of Action" is selected.The opened window will have 2 combo boxes. One is named as "From" and another one is named as "Action".

04.The From combo box will have the list of Tests available. We can select a particular Test which contains the action to be copied or we can select a particular test by clicking on the browse button which is located just adjacent to the combo box.

Note: Assume that the browse button is clicked and the Test which contains the Action to be copied is selected. Now the system will ask for the path. We can choose either absolute and relative path.

06.Once the test is selected, we need to select the action to be copied.To do this, we need to click on the Action combo box which is located just below the From combo box.

07.Once the action is selected,the type of copied action[Usable/Non-Reusable] action will also be displayed and also we can find a text box "Exit New Action Properties". We have to select this option if we want to make some changes the copied action.

 Note:Assume that we didn't select "Edit New Action Properties" check box when selecting the action. We can do this later by navigating to Keyword View> Right Click> Action> Action Properties tab.

08.We can also find two more options named as "At The End Of the test" and "After the Current" step. We can select any one of these two options.

09.Once everything is finalized click OK and observe that the action is inserted into the test as a call to independent, non-reusable action.

10.We can move our action call to another location by dragging it to the desired location.

Different Ways To Get And Count Objects In QTP

Getting and counting the number of objects on a web page is important factor as part of Automation testing. This article explains the different ways available to get and count the objects.

Descriptive Programming:
This approach uses Description Object, which contains a mask for objects we would to get.
 
Code Snippet:
 Set oDesc = Description.Create
 oDesc("micClass").Value="Link"
 Set Links = Browser("aaa").Page("bbb").Page("ccc").ChildObjects(oDesc)
 MsgBox "Total Links" &Links.count

The method ChildObjects returns the collection of child objects matched the description ("micclass" is "Link") and containted within the object Page("ccc").

Object QTP property Collections:
As we know that QTP can work with Document Object Model(DOM).
 
Code Snippet:
 Set Links = Browser("aaa").Page("bbb").Page("ccc").Objects.Links
 MsgBox "Links Count" & Links.Length
 We used Object property of a page object which represents the HTML Document in a given browser. The HTML document contains different collections like forms, frames, images, linls. etc. We used Length property to get the number of items in the collection.

Object QTP Property & GetElementByTagName:
We can get access to the HTML Document by using Object property of the page and use its GetElementByTagName method to get the number of links on the page.
 
Code Snippet:
Set Links = Browser("aaa").Page("bbb").Object.GetElementByTagName("a")
MsgBox "Total Links" & Links.Length
 
We can use the above methods for finding the images,webedits, list of objects on a web page.

Capturing Tool Tip Of A Link In QTP

As we know that the Tool tip or infotip or a hint is a common graphical user interface element. It's used in conjunction with a cursor,usually a pointer.The user hovers the pointer over an item without clicking it, and a tooltip may appear - a small "hover box" with information about the item being hovered over.

Capturing Toop Tip(TT) in QTP is not a difficult task. We need to follow some steps to achieve this.

01. Place the mouse cursor over the link
02. Wait for tool tip
03. Get Text of the shown tool tip

Use the following code snippet to capture the text of a tool tip.

'Place the mouse cursor over the link
Browser("aaa").Page("bbb").WebElement("text:=Link Name").FireEven "onmouseover"
Wait 3
'Grab the tool tip
TT=Window("nativeclass:=tooltips_class32").GetRoProperty("text")

Please read the following steps which explains the details about the above code snippet.

01.We use FireEvent("onmouseover") to simulate mouse placing over the link.
02.Function Wait waits for 3 seconds for a tool tip.
03.To get tool tip we used the "("nativeclass:=tooltips_class32").GetROProperty("text")"

We can compare the captured tool tip with the expected if required. I hope this article is helpful in capturing the Tool tip of any link

VBScript Syntax Rules And Guidelines

Case Sensitive:
VBScript is not case sensitive.It means that it doesn't differentiate between upper case and lower case spelling of words, variables, objects and methods names or constants.

For example, Browser("aaa").Page("bbb").WebList("today").Select "131"
Browser("aaa").Page("bbb").WebList("Today").Select "131"will be treated in same way by QTP.

Text Strings:
When a value is entered as a text string, we should add quotation mark before and after the string.But we need to remember that the numbers also should be surrounded by quoatation marks, beacuse it's a text string that represent a number not a numeric value when the number is entered into a text box.

One more should be considered that the variables should not be surrounded by quotation marks.

For example: Browser("aaa").Page("bbb").WaitProperty("variable name", variable,20000)

Variables:
We can use the variable to store strings,integers,arrays and objects.Using variables is very helpful to make the scripts more readable and flexible.

Parenthesis:
To achieve the desired result and to avoid errors,it's important that we use parenthesis() correctly in our statements.

Indentation:
We can indent or out-dent our script to reflect the logical structure of the nesting of the statements.

Comments:
We can add the comments before writing a line or at the end of the statement.We have to use apostrophe(') to represent the comments.It's recommended to add the comments wherever possible, to make our scripts easier to understand and maintain.

Spaces:
We can add spaces in our script to improve clarity. These spaces are ignored by VBScript.

QTP Driver Script

Actually we are using VBScript in most of the areas in QTP. But the Driver Script is the only QTP script, reated to all are VBscript files(.VBS).



Driver script is mainly useful to organize the Tests Execution and stores Test Logs in the specified file/folder.

Example:

adding sheets to runtime data table
datatable.AddSheet ("Module")
datatable.AddSheet ("Testcase")
datatable.AddSheet ("Teststep")

'Adding data sheets to runtime data table

Tcrowcount=datatable.GetSheet ("Testcase").getrowcount
        For j=1 to Tcrowcount step 1
           datatable.SetCurrentRow (j)
           moduleid1=datatable.Value(4,"Testcase")
           tcexe=datatable.Value(3,"Testcase")
           If moduleid=moduleid1 and Ucase(tcexe)="Y" Then
               TcId=datatable.Value(1,"Testcase")
               Tsrowcount=datatable.GetSheet("Teststep").getrowcount
               For k= 1 to Tsrowcount step 1
               datatable.SetCurrentRow(k)
               Tcid1=Datatable.Value(5,"Teststep")
                   If TcId= TcId1 Then
                       keyword= datatable.Value(3,"Teststep")
                       Select Case keyword
                       Case "ln"
                       res=Login()
                       datatable.Value(6,"Teststep")=res
                       Case "ca"
                           close_app
                       Case "op"
                           res=Openord()
                           datatable.Value(6,"Teststep")=res
                
                        End Select
                    End If
                Next
            End If
        Next
    End If
Next
datatable.ExportSheet "D:\Automation\Testlog\results.xls","Teststep"

Sample Initialization Script:

Initialization Script launches QTP Tool and Calls Driver Script, Driver Script execute Tests and Stores Results.
Finally   Initialization Script Closes QTP tool

Option Explicit
Dim qtApp
set qtApp=createobject("QuickTest.Application")
qtApp.Launch
qtApp.Visible=True
qtApp.Open "D:\Automation\Testscripts\Driver"
qtApp.Test.Run
qtApp.Quit