FAQ

Close all browsers except Google ??

 brName = "www.google.co.in"

 

 set EditDesc = Description.Create()

 EditDesc("micclass").value = "Browser"

 

 set objBrw = Desktop.childObjects(EditDesc)

 intbrCount = objBrw.Count

 

 for i=0 to intbrCount -1

 

 if brName <> objBrw(i).name then

 objBrw(i).close

 end if

  Next

 

 

Write a program which interface to outlook application ???

 

Dim a(5)

 

  a(0) = 1

  a(1) = 2

  a(2) = 3

  a(3) = 4

  a(4) = 5

  a(5) = 6

 

  Set odict = createobject("scripting.dictionary")

 

  For i=0 to 5

 odict.Add i, a(i)

  Next

 

  print "number of items in dictionary = " &  odict.Count

  print clear 

  For each key in odict

 print odict.Item(key)

  Next

 

  Set oFso = createobject("Scripting.filesystemobject")

 

  oFso.CopyFile "C:\DOCUME~1\skumar16\LOCALS~1\Temp\QTPrintLog.txt", "C:\"

 

  Set oOut = CreateObject("Outlook.application")

  Set oMail = oOut.CreateItem(0)  

  oMail.display

  oMail.to = "sanjeet.a.kumar@capgemini.com"

  oMail.cc = "sanjeet.a.kumar@capgemini.com"

  oMail.subject = "Print Log of QTP"

  oMail.attachments.add("C:\QTPrintLog.txt")

  omail.send

 

 

 

write a driver script which interact with QC, QTP and run the script ???

 

 

'********************TEST DRIVER SCRIPT***************************

'Declare Variables

Dim strSendTo,strSubject, strBody,strAttachment,strPath,strSendCC

 

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

Dim qtTest 'As QuickTest.Test ' Declare a Test object variable

Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

msgbox "Invoking QTP Application IDE"

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object

qtApp.Launch ' Start QuickTest

qtApp.Visible = True ' Make the QuickTest application visible

qtApp.WindowState = "Maximized" ' Maximize the QuickTest window

qtApp.ActivateView "ExpertView" ' Display the Expert View

 

msgbox "Done"

 

' Set QuickTest run options

qtApp.Options.Run.ImageCaptureForTestResults = "OnError"

qtApp.Options.Run.RunMode = "Fast"

qtApp.Options.Run.ViewResults = True

 

'This will Open a script

qtApp.Open "[QualityCenter] Subject\Automation\Test_Driver\Main_Script"' Open the test in read-only mode

 

 

' set run settings for the test

Set qtTest = qtApp.Test

qtTest.Settings.Run.IterationMode = "rngIterations" ' Run only iterations 2 to 4

qtTest.Settings.Run.StartIteration = 1

qtTest.Settings.Run.EndIteration = 1

qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs

 

'For Viewing Results

Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object

qtResultsOpt.ResultsLocation = "C:\Automation\Test_Results" ' Set the results location

qtTest.Run qtResultsOpt ' Run the test

qtApp.Options.Run.ViewResults = True 

strPath=qtTest.LastRunResults.Path

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' System Local Monitoring settings

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

With qtApp.Test.Settings.LocalSystemMonitor

.ApplicationName = "NEMOGUI"

.Enable = True

.SampleRate = 1

.SystemCounters.RemoveAll

.SystemCounters.Add "Memory Usage (in MB)", -1

.SystemCounters.Add "% Processor Time", -1

.SystemCounters.Add "Creating Process ID", -1

.SystemCounters.Add "GDI Objects", -1

.SystemCounters.Add "Handle Count", -1

.SystemCounters.Add "Thread Count", -1

.SystemCounters.Add "Elapsed Time", -1

End With

'Close QTP

'qtTest.Close ' Close the test

 

'*************************************************************

'strPath=qtApp.Test.LastRunResults.Path

 

strSendTo="neil.dsouza@capgemini.com"

strSubject="QTP Test Automation Execution Report"

strBody="Hi All"&vbNewLine&"Please Find the attached html file for the Automation Execution Results."

strAttachment=strPath&"\Log\LogFile.html"

strSendCC="Jitendra.choudhary@capgemini.com;prerit.mehta@capgemini.com;nilotpal.kumar@capgemini.com;prashant.vatkar@capgemini.com"

SendMail strSendTo,strSendCC,strSubject,strBody,strAttachment

 

 

'Set the options to nothing

Set qtResultsOpt = Nothing ' Release the Run Results Options object

Set qtTest = Nothing ' Release the Test object

Set qtApp = Nothing ' Release the Application object

 

Function SendMail(SendTo,SendCC, Subject, Body, Attachment)

    Set OutApp = CreateObject("Outlook.Application")

    Set OutMail = OutApp.CreateItem(0)

        On Error Resume Next

        With OutMail

            .to =strSendTo

            .CC =strSendCC

            .BCC = ""

            .Subject =strSubject

            .Body =strBody

            .Attachments.Add strAttachment

            'You can add other files also like this

            .Attachments.Add ("C:\Automation\Test_Results\TestResult.htm")

            .Display   'or use 

            '.Send

        End With

   

 

    'Delete the file you have send   Kill TempFilePath & TempFileName & FileExtStr

 

    Set OutMail = Nothing

    Set OutApp = Nothing

End Function

'*******************************************

Function FListTempFiles()

'Option Explicit

Dim objFSO, objFiles, objShell, intCount

Dim strFile, strName, strLongName, strDirectory, strEnv, strExt

Set objShell = CreateObject("Wscript.Shell")

strEnv = objShell.ExpandEnvironmentStrings("%temp%")

intcount = 0

 

' Create the File System Object

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFSO = objFSO.GetFolder(strEnv)

Set objFiles = objFSO.Files

For each strFile in objFiles

   strExt = strFile.Type

     If ucase(strExt) = "TMP FILE" Then

     strName = strFile.Name

     strLongName = strLongName & strName & VBTab & VBTab

     intCount = intCount +1

   End if 

next

WScript.Echo "The number of temp files is: " & intCount

WScript.Echo strLongName & VbCr & intCount

set objFSO = nothing

set strFile = nothing

set objFiles = nothing

WScript.Quit

End Function

Function FDeletTempFile()

'Option Explicit

Dim objFSO, objFiles, objShell, intCount

Dim strFile, strName, strDirectory, strEnv, strExt

Set objShell = CreateObject("Wscript.Shell")

' ---------------------------------------------------------

' Below is where you edit to delete files in %temp% folder

'strEnv = "D:\temp"

 strEnv = objShell.ExpandEnvironmentStrings("%temp%")

intcount = 0

 

' Create the File System Object

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFSO = objFSO.GetFolder(strEnv)

Set objFiles = objFSO.Files

For each strFile in objFiles

On Error Resume Next

    strFile.delete 

    intCount = intCount +1

next

 

set objFSO = nothing

set strFile = nothing

set objFiles = nothing

WScript.Echo intCount & " files were deleted"

WScript.Quit

End Function

 

 

Write a prerequisite script for QTP to do setting of QTP ???

 Option Explicit

 

' Declaring Variables

Dim objQTP, objActiveScreenOpt, objWebActiveScreenOpt, objWebOptions, objBrowser,objRespPath

Dim qtIdent

Dim strLocationOfConfigFile

 

' Location of the confiuration file  

strLocationOfConfigFile = "[QualityCenter] Subject\Phase 2\"

 

' Location of the login details spreadsheet

Const conUserLoginDetails = "Z:\UserLoginDetails"

 

    ' Load the environment file (Change the path to point to the config file as required)

' Environment.LoadFromFile(strLocationOfConfigFile&"\Common_Files\GlobalVariableAndConfigFile.ini")

    

'Object Repository Path

objRespPath = "[QualityCenter] Subject\Phase 2\"

 

' Create a QTP object

Set objQTP = CreateObject("QuickTest.Application")

objQTP.Launch

objQTP.Visible = True

objQTP.Options.DisableVORecognition = False

' Set autogenerate With statements to No

objQTP.Options.AutoGenerateWith = False

objQTP.Options.WithGenerationLevel = 2

objQTP.Options.TimeToActivateWinAfterPoint = 500

objQTP.Options.SaveLoadAndMonitorData = False

objQTP.Options.Web.RecordCoordinates = False

objQTP.Options.Web.RecordMouseDownAndUpAsClick = False

objQTP.Options.Web.RecordAllNavigations = False

objQTP.Options.Web.RecordByWinMouseEvents = ""

objQTP.Options.Web.BrowserCleanup = False

objQTP.Options.Web.RunOnlyClick = False

objQTP.Options.WindowsApps.AttachedTextRadius = 35

objQTP.Options.WindowsApps.AttachedTextArea = "TopLeft"

objQTP.Options.WindowsApps.ExpandMenuToRetrieveProperties = True

objQTP.Options.WindowsApps.NonUniqueListItemRecordMode = "ByName"

objQTP.Options.WindowsApps.RecordOwnerDrawnButtonAs = "PushButtons"

objQTP.Options.WindowsApps.ForceEnumChildWindows = 0

objQTP.Options.WindowsApps.ClickEditBeforeSetText = 0

objQTP.Options.WindowsApps.VerifyMenuInitEvent = 0

' Set text recognition option

objQTP.Options.TextRecognitionOrder = "APIThenOCR"

' Enable smart identification and ordinal identifier for Web Browser and Page

Set qtIdent = objQTP.Options.ObjectIdentification ' Return the ObjectIdentification object

Set objBrowser = qtIdent.Item("Browser") ' Return the collection of object identification properties for the WinList object class

objBrowser.EnableSmartIdentification = True

objBrowser.OrdinalIdentifier = "CreationTime"

Set objBrowser = qtIdent.Item("Page") ' Return the collection of object identification properties for the WinList object class

objBrowser.EnableSmartIdentification = True

objBrowser.OrdinalIdentifier = "Index"

' Active screen settings

Set objActiveScreenOpt = objQTP.Options.ActiveScreen

objActiveScreenOpt.CaptureLevel = "Partial"

Set objWebActiveScreenOpt = objActiveScreenOpt.Web ' Return the Web Active Screen object

objWebActiveScreenOpt.ActiveScripts = "Automatic" ' Prevent running scripts when loading a page in Active Screen

objWebActiveScreenOpt.CaptureOriginalHTMLSource = False ' Capture the original HTML source of Web pages before any scripts have run

objWebActiveScreenOpt.LoadActiveXControls = False ' Do not load ActiveX controls in the Active Screen pane

objWebActiveScreenOpt.LoadImages = True ' Do not load images in the Active Screen pane

objWebActiveScreenOpt.LoadJavaApplets = False '

' Set the Custom Active screen settings

objActiveScreenOpt.CapturedFilesStorage = "Compressed"

' Run Tab settings

objQTP.Options.Run.RunMode = "Normal"

objQTP.Options.Run.ViewResults = True

objQTP.Options.Run.StepExecutionDelay = 500

' Save Movie options

objQTP.Options.Run.MovieCaptureForTestResults = "OnError"

objQTP.Options.Run.SaveMovieOfEntireRun = "FALSE" 'Save only the movie segements that lead up to an error or warning

objQTP.Options.Run.MovieSegmentSize = "2048"

' Save Still Image capture to results

objQTP.Options.Run.ImageCaptureForTestResults = "OnError"

' Web Options

Set objWebOptions = objQTP.Options.Web ' Return the Web Options object

objWebOptions.AddToPageLoadTime = 30

' Page/Frame options

objWebOptions.PageCreationMode = "Description"

objWebOptions.FrameCreationMode  = "Description"

' Advanced web options

objWebOptions.EnableBrowserResize = True ' Set to open the browser to its default size

objWebOptions.RunUsingSourceIndex = True

objWebOptions.RunMouseByEvents = True

' Add all relevant folders

objQTP.Folders.RemoveAll

' RepositoriesCollection.RemoveAll() 'Added by Devesh

' RepositoriesCollection.Add(objRespPath) 'Added by Devesh

 

' ' Location for the user login details

objQTP.Folders.Add(conUserLoginDetails)

'

' ' Add the global paths

' objQTP.Folders.Add(strLocationOfConfigFile & "\Common_Files")

'

' ' Add the 00_HelpDesk paths

' objQTP.Folders.Add(strLocationOfConfigFile & "\00_Helpdesk\Test_Scripts")

' objQTP.Folders.Add(strLocationOfConfigFile & "\00_Helpdesk\Test_Data")

' objQTP.Folders.Add(strLocationOfConfigFile & "\00_Helpdesk\Reusable_Scripts")

' objQTP.Folders.Add(strLocationOfConfigFile & "\00_Helpdesk\Object_Repository")

'

' ' Add the 01_CallReport paths

objQTP.Folders.Add(strLocationOfConfigFile&"\Test_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile&"\Test_Data")

objQTP.Folders.Add(strLocationOfConfigFile&"\Reusable_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile&"\Object_Repository")

objQTP.Folders.Add(strLocationOfConfigFile&"\Common_Files")

objQTP.Folders.Add(conUserLoginDetails)

 

' ' Add the 03_CallML5 paths

'objQTP.Folders.Add(strLocationOfConfigFile & "\02_Oscar\Test_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile & "\02_Oscar\Test_Data")

objQTP.Folders.Add(strLocationOfConfigFile & "\02_Oscar\Reusable_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile & "\02_Oscar\Object_Repository")

     

' ' Add the 03_CallML5 paths

' objQTP.Folders.Add(strLocationOfConfigFile & "\Test_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile & "\Test_Data")

objQTP.Folders.Add(strLocationOfConfigFile & "\Reusable_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile & "\Object_Repository")

 

 

 

' ' Add the 05_TAC paths

objQTP.Folders.Add(strLocationOfConfigFile & "\05_TAC\Test_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile & "\05_TAC\Test_Data")

objQTP.Folders.Add(strLocationOfConfigFile & "\05_TAC\Reusable_Scripts")

objQTP.Folders.Add(strLocationOfConfigFile & "\05_TAC\Object_Repository")

'

' Add the 05_CRTAC_Combined_User paths

' objQTP.Folders.Add(strLocationOfConfigFile & "\05_CRTAC_Combined_User\Test_Scripts")

' objQTP.Folders.Add(strLocationOfConfigFile & "\05_CRTAC_Combined_User\Test_Data")

' objQTP.Folders.Add(strLocationOfConfigFile & "\05_CRTAC_Combined_User\Reusable_Scripts")

' objQTP.Folders.Add(strLocationOfConfigFile & "\05_CRTAC_Combined_User\Object_Repository")

'

'

 

' Clear the objects

Set objQTP = Nothing

Set objActiveScreenOpt = Nothing

Set objWebActiveScreenOpt = Nothing

Set qtIdent = Nothing

Set objBrowser = Nothing

 

 

QTP Interview Questions ???

 2) What are the types object Repositories in QTP.

QTP Supports 2 types of Object Repository

 

1) Shared Object Repository (also called Global)


2) Per-Action Object Repository, (also called Local)

 

Per-Action Object Repository is used by default. The extension for Per-Action repository is ".mtr" .

Shared Object Repository is preferable while dealing with dynamic objects which are called in multiple tests. The extension is ".tsr"

 

3) Can we call QTP test from another test using scripting. Suppose there are 4 tests and I want to call these tests in a main script. Is this possible in QTP? 

Yes.  You can call 4 or even more scripts in your tests.For this, first you will need to make the Actions in the corresponding scripts re-usable.Then from the destination script you can make calls to these re-usable actions.

 

4) What is action split and the purpose of using this in QTP?

Action split is to divide an existing action into two parts.The purpose is to divide actions based on their functionality to improve code re-use.

 

5) How will you handle Java tree in QTP ?

Foremost you will select Java Add - In and launch QTP. Next step record operations on the Java Tree. If you face an issue while recording, you can select Tools > Object Identification > Java, tree object and make changes in mandatory and assistive properties to enable identification.

Tip: You can base you answer on similar lines for any other object of any environment. For example : If the question is how will check SAP checkbox , You say , first I will select SAP Add in ... and so on.

 

6) Explain 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 the Object Identification settings) in the object repository of the GUI object . At run-time, QTP will compare the stored property values with the on-screen properties, to uniquely identify the GUI object.

Learn more about Object Identification

 

7) How many types of recording modes in QTP? Which will be used when ?

QTP supports 3 types of recording modes

1. Normal mode also called Contextual

2. Low-level recording mode

3.Analog mode

 

Normal Mode: It is the default recording mode and takes full advantage of QTP's Test Object Model. It recognizes objects regardless of their position on -screen. This is the preferred mode of recoding and is used for most of the automation activities.

Low-level recording mode: This mode records the exact x,y co-ordinates of your mouse operations. It is helpful in testing hashmaps. It is useful for recording objects not identified by normal mode of QTP.

Analog mode: This mode records exact mouse and keyboard "movements" you perform in relation to the screen / application window. This mode is useful for the operation such as drawing a picture, recording signature., drag and drop operations.

 

Learn more about Recording Modes in QTP

 

8) How will you  call from one action to another action ?

We can call an action in 2 ways

1) Call to copy of Action. - In this ,the Action Object Repository , Script and Datable will be copied to the destination Test Script.
2) Call to Existing Action. - In this,  Object Repository , Script and Datable  will NOT be copied but a call (reference) would be made to the Action in the source script.

 

9) What are Virtual Objects?

Your application may contain objects that behave like standard objects but are not recognized by QTP. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box. QTP emulates the user's action on the virtual object during the run session. In the test results, the virtual object is displayed as though it is a standard class object.

For example, suppose you want to record a test on a Web page containing a bitmap that the user clicks. The bitmap contains several different hyperlink areas, and each area opens a different destination page. When you record a test, the Web site matches the coordinates of the click on the bitmap and opens the destination page.

To enable QTP to click at the required coordinates during a run session, you can define a virtual object for an area of the bitmap, which includes those coordinates, and map it to the button class. When you run a test, QTP clicks the bitmap in the area defined as a virtual object so that the Web site opens the correct destination page.

 

10) How to perform Cross platform testing and Cross browser testing using QTP? Can u explain giving some example?

You will need to create separate Actions which take care of different OS and Browsers

Cross Platform Testing:

Using the Built in Environment Variable you can dig up the OS information.

Eg. Platform = Environment("OS"). Then based on the Platform you need to call the actions which you recorded on that particular platform.

Cross Browser Testing:

Using this code  Eg. Browser("Core Values").GetROProperty("version") you can extract the Browser and its correspondin version. Ex: Internet Explorer 6 or Netscape 5. Based on this value you call the actions which are relevant to that browser.

 

11) What is logical name of the object?

Logical name is a name  given by  QTP while creating an object in the repository to uniquely identify it from other objects in the application. This name would be used by the QTP to map the object name in script with its corresponding description in the object repository. Ex: Browser("Browser").Page("Guru99") Here Guru99 is the logical name of the object.

 

12) What is descriptive programming?

Typically ,an object and its properties must be recorded in the Object Repository to enable QTP to perform action s on it. 

Using descriptive programming , you do not store the object and its property values in the Object repository but mention the property value pair directly in the script.

The idea behind descriptive programming is not bypass the object repository but help recogonize dynamic objects.

 

Learn more about Descriptive Programming

 

13)What are the properties you would use for identifying a browser & page when using descriptive programming ?

You can use the name property

ex: Browser("name:="xxx"").page("name:="xxxx"")..... 

OR 

We can also use the property "micClass". 
ex: Browser("micClass:=browser").page("micClass:=page")....

 

14)Can we record an application running on a remote machine using QTP ?

Yes .you can record remote application provided you are accessing application through the local browser not via remoter like citrix.

If you are still unable to record it is advisable install QTP and application, on the same machine

 

15) Explain the keyword CreateObject with an example.

Creates and returns a reference to an Automation object

SYNTAX: CreateObject(servername.typename [, location])

Arguments 
servername: Required. The name of the application providing the object. 
typename :  Required. The type or class of the object to create. 
location :  Optional. The name of the network server where the object is to be created.

Example : Set IE = CreateObject("InternetExplorer.Application")

 

16) Can you switch between Per-Action and Shared Object Repository ? If yes how ?

Yes .We can switch. Go to Test--->Settings--->Resources. Here  you have an option to choose repositories.

 

17) What is Object Spy ? How to Use it ?

Object Spy helps in determining the run & test time object properties & methods of the application under test.

You can access object spy directly from the toolbar or from the Object Repository Dialog Box.

It is very useful during Descriptive Programming

 

Learn more about Object Spy

 

18) When ordinal identifiers alone can make an object unique then why they are not given top priority? Why it is first mandatory and next assistive. Why we cannot go for ordinal identifiers directly?

Consider the following -

a) If two objects are overlapped on each other than location based object recognition will fail.

b) If only index based recognition is used your script will work but script execution time will increase.

Hence mandatory and assistive properties are used.

 

19) What is the file extension of the code file in QTP?

Code file extension is script.mts

 

20) Explain in brief about the QTP Automation Object Model.

QTP Automation Object model deals with Automation of QTP itself. Almost all configuration and functionality provided by QTP is represented by QTP's Automation Object Model . Almost all dialog boxes in QTP have a corresponding automation object which can set or retrieved using the corresponding properties or methods in the Automation Object Model.QTP Automation Objects can be used along with standard VB programming elements like iterative loops or conditional statements to help you design a script of choice.

 

21) What is the use of Text output value in QTP?

Text Output values enable you to capture text appearing on the application under test during run-time.

If parameterized, text output values will capture values appearing in each iteration which would be stored in the run-time data table for further analysis.

 

22) What is Step Generator?

Step Generator enables use to Add Test Steps in your script. Using step generator you can add steps to your script without actually recording it.

 

23) How to make QTP understand the difference amongst the  same type of objects .Suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?

You can use ordinal identifiers like index along with a little descriptive programming for object recognition.

 

Watch a video of this example.

 

24) What is Test Fusion Report ?.

Test Fusion Report , displays all aspects of a test run and is organized in a Tree format.

It gives details of each step executed for all iterations.

It also gives Run-time data table, Screen shots and movie of the test run if opted.

 

25) How can you handle exceptions in QTP?

In QTP Exceptional handling is done by using

a. Recovery Scenarios.
b. Using “On Error” statement

In Recovery scenario you have to define.
1. Triggered Events. 
2. Recovery steps.
3. Post Recovery Test-Run.

At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.

 

 

26) What are the types of environment variables in QTP ?

Environment variables in QTP are of three types:

1) Built-in (Read only)

2) User-defined Internal (Read only)

3) User-defined External (Read/Write)

 

You Set the Environment Variable  using the following syntax 

Environment.Value( "name") = "Guru99"

You can Retrieve the Environment Variable using following syntax

Environment.Value("name") -- This will retrun name as Guru99

Environment.Value("OS")  -- This will return your system OS

 

27) What is the Difference between Bitmap Check point & Image Check point?
Bitmap 
checkpoint does a pixel to pixel comparison of an image or part of an image.

Image checkpoint does do a pixel to pixel comparison but instead compare image properties like alt text , destination url etc.

 

28) What is the difference between functions and actions in QTP?

Actions have their own Object Repository & Data Table. Actions help make your Test modular and increase reuse. Example: You can divide your script into Actions based on functionality like Login, Logout etc.

Functions is a VB Script programming concept and do not have their own Object Repository or Data Table. Functions help in re-use of your code. Ex:  You can create a Function in your script to concatenate two strings.

 

29) What is keyword view and Expert view in QTP? -

Keyword View is an icon based view which shows test steps in tabular format. It also automatically generates documentation for the test steps.

Expert View gives the corresponding VB Script statement for every test step in the Keyword view.

 

30)  Explain QTP Testing process? -

Quick Test testing process consists of 6 main phases:

1)  Create your test plan - This is preparatory phase where you identify the exact test steps, test data and expected results for you automated test. You also identify the environment and system configurations required to create and run your QTP Tests.

2) Recording a session on your application - During this phase , you will execute test steps one by one on your AUT ,and QTP will automatically record corresponding VB script statements for each step performed.

3) Enhancing your test - In this stage you will insert checkpoints , output values , parameterization , programming logic like if…else loops to enhance the logic of your test script.

4) Replay & Debug - After enhancements you will replay the script to check whether its working properly and debug if necessary.

5) Run your Tests - In this phase you will perform the actual execution of your Test Script.

6) Analyzing the test results - Once test run is complete, you will analyze the results in the Test Fusion report generated.

7) Reporting defects - Any incidents identified needs to be reported. If you are using Quality Center , defects can be automatically raised for failed tests in QTP.

 

31) What are the different types of Test Automation Frameworks ?

The types of Automation Frameworks are -

1) Linear Scripting - Record & Playback

2) The Test Library Architecture Framework.

3)The Data-Driven Testing Framework.

4)The Keyword-Driven or Table-Driven Testing Framework.

Learn more about Test Automation Frameworks.

 

32) How will you check a web application for broken links using QTP?

You can use the Page Checkpoint which gives a count of valid/invalid links on a page.

 

33) What is a Run-Time Data Table? Where can I find and view this table?

Data like parameterized output , checkpoint values , output values  are stored in the Run-time Table. It is an xls file which is stored in the Test Results Folder.  It can also be accessed in the Test Fusion Report.

 

34) What is the difference between check point and output value.

Check point is a verification point that compares a current value for a specified property with the expected value for that property. Based on this comparison, it will generate a PASS or FAIL status. 

An output value is a value captured during the test run and can be stored in a specified location like the  Datable or even a va

 

 

 

elimnate duplicate values from Array and store it in another array ???

Dim blnstatus
blnstatus = true
Dim arrA(10)
Dim arrC()
arrA(0) = 6
arrA(1) = 5
arrA(2) = 1
arrA(3) = 2
arrA(4) = 6
arrA(5) = 3
arrA(6) = 4
arrA(7) = 4
arrA(8) = 3
arrA(9) = 2
arrA(10) = 6
redim arrC(1)
arrC(0) = arrA(0)
k=1
 for i = 1 to ubound(arrA)
  for j= 0 to ubound(arrC)
  if (arrA(i) = arrC(j)) then
     blnstatus = False
  exit for
  else
  blnstatus = true
   end if
   next
  if blnstatus = True then
     redim preserve arrC(k)
     arrC(k) = arrA(i)
  k=k+1
   end If
  next
for i = 0 to ubound(arrC)
msgbox arrC(i)
next
 

 


 

Maximize an Internet explorer window with the help of hwnd object???

Option Explicit

Dim objIe

Dim ohwnd

 

 Set objIe = CreateObject("InternetExplorer.application")

 objIe.Visible = True

 objIe.Navigate "www.google.co.in"

 

 ohwnd = objIe.HWND

 msgbox ohwnd

 window("hwnd:="& ohwnd).maximize

 

 

 

 

 

 

how to get number of lines in a file???

 

Dim oF

Dim text

Set oF = CreateObject("scripting.filesystemobject")

Set text = oF.OpenTextFile("d:\mor.txt",1)

 text.ReadAll

msgbox text.Line   

 

 

 

 

Maximize an existing browser in QTP??

 

browser("Welcome to Indian Railway").Page("Welcome to Indian Railway").Link("Train Berth Availability").Click

Set wObj = createobject("wscript.shell")

wObj.SendKeys "% x"

 

 

 

 

Write a program to get all folders files and wintoolbar item present on desktop???

 

 

Dim dObj,editDesc

Dim dObjCnt

 

 Set editDesc = Description.Create

 editDesc("micclass").value = "Window"

 

 Set dObj = Desktop.ChildObjects(editDesc)

 dObjCnt = dObj.count

 

 msgbox dObjCnt

 

 For i=0 to dObjCnt-1

msgbox dObj(i).getroproperty("title")

 Next

 

 Set oF = createObject("scripting.filesystemObject")

 

  Set oFolders = oF.GetFolder("C:\Documents and Settings\skumar16\Desktop")

 

  Set osubFolders = oFolders.SubFolders

 

   msgbox "Total no of folders =" & osubFolders.Count

   

  For each osubFolder in osubFolders

 msgbox osubFolder.name

 

  Next

 

  set ofiles = oFolders.files

  msgbox "total number of Files =  " & ofiles.Count

 

  For each ofile in ofiles

 msgbox ofile.name

  Next

 

 

 

<< 1 | 2 | 3 >>