Monday, July 13, 2009

QTP interview questions

These answers may not be complete, but these should give you enough idea as to what exactly to answer, which you can elaborate on your own later on.

1. Name the types of Test Automation?

Record and Playback (does not work in real world scenario)
Functional decomposition
Keyword driven
Model Based
Hybrid Test Automation Framework etc.

2. Explain the benefits of using Test Automation?

It can be executed unattended, leaving the testers free to do other work.
Large number of data combinations can be run - Good coverage.
Re-use of test cases in the different releases/versions etc.

3. Give the names of some Test Automation products/vendors?

QuickTest Professional - HP
TestComplete - Automatedqa
Rational Robot - IBM

4. When to use Test Automation?

In one short line
Successful test-automation needs to start early in the development cycle.

For elaborate reading see:
http://www.stickyminds.com/sitewide.asp?Function=edetail&ObjectType=COL&ObjectId=2084
http://googletesting.blogspot.com/2007/10/automating-tests-vs-test-automation.html

5. Give a to the point narration of what Test Automation is?

Test automation is the use of software to control the execution of tests, the comparison of actual outcomes to predicted outcomes, the setting up of test preconditions, and other test control and test reporting functions. Commonly, test automation involves automating a manual process already in place that uses a formalized testing process. (Wikipedia)

6. Write advantages of using Test Automation?

Refer to Answer 2

7. Name any three types of applications you can run Test Automation on?

Test automation can be run on Windows applications, Web applications, .Net Applications, Java applications etc.

8. When would we not want to use Test Automation?

If the product is not mature enough.
If you don't have the time. The product is to be shipped after one month and you think you can buy a tool and automate a testing process in order to complete early is all rubbish. (See answer 4)

9. Give the steps of GUI Test Automation?

(related to QuickTest)
Analyzing your application
Preparing the testing infrastructure
Building your tests and adding steps to them
Enhancing your test
Debugging, running, and analyzing your test
Reporting defects

10. Explain the difference between Keyword view and Expert view?

The Keyword View is comprised of a table-like view, in which each step is a separate row in the table, and each column represents the different parts of the steps.

In the Expert View, you can view an action in VBScript. If you are familiar with VBScript, you can add and update statements and enhance your tests and function libraries with programming.

11. How to start recording with a keyboard shortcut?

F3

12. How to stop recording with a keyboard shortcut?

F4

13. How to playback from top with a keyboard shortcut?

F5

14. Is it possible to customize keyword view Fonts and colors?

Yes, Tools ->View Options.. and go to Fonts and Colors tab.

15. When will you use Shared and when local object repository?

Local Object Repository may be used if
You have only one, or very few, components that correspond to a given application, interface, or set of objects.
You do not expect to frequently modify object properties.

Shared Object Repository may be used if
You expect the object properties in your application to change from time to time.

You have several components that test elements of the same application, interface, or set of objects.

16. What will you choose between OR and DP and why?

Object Repository or Descriptive Programming

17. What is the use of the Object Repository?

All About Object Repositories

18. What's the extension of the exported Object Repository file?

.xml

19. Explain when is the Object Repository read from?

At run time.

20. Write any 3 advantages of the Object Repository?

Refer to Answer 16

21. Why is there a need for an Object Repository Administrator?

Its not necessary but it is quite a lot helpful to have one to manage (create new ORs, manage repository parameters, modify object details, merging etc) shared object repositories and to see that the reusibility of the tests is maintained w.r.t. shared object repository.

22. When exactly is the Object Repository populated?

During recording.

23. Explain what is a Shared Object Repository?

Refer to Answer 17

24. Explain the steps to modify a Shared Object Repository?

You can modify a test object in the shared object repository using the Object Repository Manager.

To modify a test object property:

Right-click the step containing the test object that changed, and choose Object Properties or choose Edit > Step Properties > Object Properties from the menu bar.

The Object Properties dialog box opens and displays the properties QuickTest uses to identify the object.

Modify the properties and values as required. You modify the properties and values in the Object Properties dialog box in the same way as you modify the test object details in the Object Repository window.

Click OK to close the dialog box.
---------- ----------
The object details area for shared object repositories in the lower right side of the document window enables you to view and modify the properties and property values used to identify an object during a run session or the properties of a checkpoint or output object.

After making sure that your shared object repository is editable, and that it is the active window, you modify object details for objects in a shared object repository in the same way as you modify them for local objects. etc


25. How do you assign a Shared Object Repository to an action?

You can associate a single action with an object repository by right-clicking the action in the Resources pane and choosing Associate repository with action from the context menu.

You can use the Associated Repositories tab of the Action Properties dialog box (Edit > Action > Action Properties) to associate one or more object repositories with the current action etc.

26 What are the names of UI Objects?

Few examples are Button, Listbox, Checkbox

27 Write the names of any 3 UI Objects?

Refer answer 26

28 What is a Test Object?

A test object is an object that QuickTest creates in the test to represent the actual object in your application. QuickTest stores information on the object that will help it identify and check the object during the run session.

29 Explain what do you mean by run-time objects?

A run-time object is the actual object in your application on which methods are performed during the run session.

30 What is the class attribute of a UI Object?

Few examples are WinButton, WinEdit etc

31 What is the physical description or attributes of a UI Object?

For example for an OK button physical attributes can be Class Name = WinButton, text = 'OK' etc

32 How and Where can I modify a name of a Test Object?

Refer to answer 24

33 How can I highlight a Test Object and make it flash?

You can select a test object in your object repository and highlight it in the application you are testing. When you choose to highlight a test object, QuickTest indicates the selected object's location in your application by temporarily showing a frame around the object and causing it to flash briefly.
Make sure your application is open to the correct window or page.
Select the test object you want to highlight in your object repository.
Click the Highlight in Application button or choose View > Highlight in Application. The selected object is highlighted with a border in the application.

34 Explain the purpose of Object Spy?

Using the Object Spy pointing hand mechanism, you can view the supported properties and methods of any object in an open application.

35 What is a virtual object?

You can teach QuickTest to recognize any area of your application as an object by defining it as a virtual object. Virtual objects enable you to create and run tests on objects that are not normally recognized by QuickTest.

36 What is the need of virtual objects?

Your application may contain objects that behave like standard objects but are not recognized by QuickTest. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box.

37 How to assign an object to a variable?

Using a Set statement.

e.g. Set FSO = CreateObject("Scripting.FileSystemObject")

38 What is a DLL?

Please see


39 Explain how to declare DLL functions?

Please see


40 Explain how to call DLL functions?

Please see



41 What is the reason for Synchronizing the Run Session?

Because applications don’t always respond to user input at the same speed from one test to another

42 Give two reasons for delays causing synchronization problems?

For a window to pop up
For a progress bar to reach 100%

43 Explain what is a Client/Server application?

The client-server software architecture model distinguishes client systems from server systems, which communicate over a computer network.

44 Explain the reason that why does a script fail when synchronization problems occur?

One of the possible reasons might be that Quicktest by default waits a certain amount of time before it continues the test and the Server was not finished and took longer than expected

45 What is a synchronization point?

Please see


46 How is the synchronization wait time determined, what plus what?

When working with Web objects, QuickTest waits up to the amount of time set for the Browser navigation timeout option, plus the time set for the object synchronization timeout

47 What else can be done if QTP is unable to solve synchronization problems?

Use Wait or Exist etc


48 Why do we use actions?

Actions help divide your test into logical units.
Actions enable you to parameterize and iterate over specific elements of a test. etc

QuickTest Professional Actions


49 Explain what is a reusable action?

QuickTest Professional Actions


50 How to call an action from another action?

Using RunAction

Example

Open a new test.

Action1 is there by default. Go to its expert view and type
msgbox "Action 1"

Go to Keyword View and from Insert (menu) choose Call to New Action. Insert Call to New Action dialog opens. Just click ok. Go to its expert view and type
msgbox "Action 2"

Go to Keyword View and from Insert (menu) choose Call to New Action. Insert Call to New Action dialog opens. Just click ok. Go to its expert view and type

RunAction "Action1"

In the Keyword View make sure that Action3 is highlighted
Go to Automation (menu) and choose Run Current Action.

51. What is an action?

When you create a test, it includes one action. Actions help divide your test into logical units, such as the main sections of a Web site, or specific activities that you perform in your application.

52. What is action template?

If you want to include one or more statements in every new action in your test, you can create an action template. For example, if you always enter your name as the author of an action, you can add this comment line to your action template. An action template applies only to actions created on your computer.

53. What are the different types of actions?



54. Explain the difference between the global and action data table?

When you output a value to the Data Table or add a Data Table parameter to your test, you can specify whether to store the data in the Global data sheet or in the action data sheet. Using Global sheet enables you to pass information between actions.

Current action sheet (local): Each action also has its own sheet in the Data Table so that you can insert data that applies only to that action.

55. How many actions can we add/Insert in a particular test?

Call to Existing
Action?

When you insert a call to a copy of an action into a test, the original action is copied in its entirety, including checkpoints, parameterization, the corresponding action tab in the Data Table, plus any defined action parameters. If the test you are copying has objects in the local object repository, the copied action's local object repository is also copied together with the action. The action is inserted into the test as an independent, non-reusable action (even if the original action was reusable).

You can insert a call to a reusable action that is stored in your current test (local action), or in any other test (external action). Inserting a call to an existing action is similar to linking to it. You can view the steps of the action in the action view, but you cannot modify them. The called action's local object repository (if it has one) is also read-only. If you call an external action, you can choose, however, whether you want the data from the action's data sheet to be imported as a local, editable copy, or whether you want to use the (read-only) data from the original action. To modify a called, external action, you must open the test with which the action is stored and make your modifications there. The modifications apply to all tests that call that action.

57. Explain an action parameter?



58. How do I call an action from another test?

Using Insert->Call to Existing Action

59. How to pass a parameter into an Action?


60. What is checkpoint timeout?

Specifies the time interval (in seconds) during which QuickTest attempts to perform the checkpoint successfully.

61. Explain types of Checkpoints you know?



62. Explain when bitmap checkpoint is used?

By adding bitmap checkpoints to your components, you can check the appearance of elements in your application by matching captured bitmaps.

You insert bitmap checkpoints while recording or editing a test.

You can check an area of an application as a bitmap.

You can create a bitmap checkpoint for any area in your application, including buttons, text boxes, and tables.

You can create bitmap checkpoints for TeWindow, TeScreen and TeTextScreen objects

Bitmap checkpoints check an area of your SAP Web application as a bitmap.

You can define a tolerance for the RGB (Red, Green, Blue) properties of a bitmap checkpoint. Defining a tolerance determines the percent by which the RGB values of the actual object are allowed to be different from those of the expected object and allow the checkpoint to pass.

Bitmap checkpoints are supported for all add-in environments.

Existing Checkpoint: If each page of your application contains your organization's logo, you can reuse a bitmap checkpoint to verify each occurrence in the application.

Last but not the least - The results of bitmap checkpoints may be affected by factors such as operating system, screen resolution, and color settings.

63. What do you know about Output values?



64. What is existing checkpoint?



65. How do you declare a variable in VBScript?



66. Explain a variable?



67. Explain a statement?



68. Explain a procedure?



69. Explain a function?



70. What DataTable functions do you know?

Data Table is made up of three types of objects—DataTable, DTSheet (sheet), and DTParameter (column). Each object has several methods and properties that you can use to retrieve or set values.

Import - Imports the specified Microsoft Excel file to the run-time Data Table.
Export - Saves a copy of the run-time Data Table in the specified location.
GetRowCount - Returns the total number of rows in the longest column in the first sheet in the run-time Data Table (global sheet). etc.

71. How do you find out what the length of the string is?

Len Function

Returns the number of characters in a string or the number of bytes required to store a variable

72. How do you convert the string to upper case?

UCase Function

Returns a string that has been converted to uppercase.

73. How do you declare an array?



74. How do you access an element of array?



75. What is an array?



76. What are the two ways to initialize an array?



77. How to load an excel file into QTP?



78. How to read cell data?

http://qtp.blogspot.com/2007/07/qtp-tutorials-3.html

79. Explain regular expression?

http://qtp.blogspot.com/2008/04/qtp-regular-expression.html

80. What is a data-driven test case?

one which uses data table parameters.

81. What tables are used for data-driven test cases in QTP?

Global data table or Action data table.

82. Name different types of recording?

http://qtp.blogspot.com/2007/05/qtp-quicktest-professional-recording.html

83. Explain when analog recording mode is used?

http://qtp.blogspot.com/2007/05/qtp-quicktest-professional-recording.html

84. Explain the difference between Context and Analog mode?

http://qtp.blogspot.com/2007/05/qtp-quicktest-professional-recording.html

Context is basically Normal mode.

85. Which record mode is used more, Context Sensitive or Analog?

I think you should answer this for yourself...should not be hard :-)

86. How to create a Runtime property for an object?

Is it really possible to create a runtime property? I think more than 20 cheap websites/blogs copied this questions from here as it is without even knowing whether it is rightly put or not and have not even answered it. Have you heard about ObjectType() or something like this? what it does? etc etc..

Update:
See a Post and a Discussion for more info.

87. How to add a runtime parameter to a datasheet?

For example add the below two lines in a new test in QTP and run it. After a successfull run, check you C: drive for excel file named flights.xls

ParamName=DataTable.AddSheet("MySheet").AddParameter("Arrival", "New York").Name
DataTable.Export ("C:\flights.xls")

OR

For example add the below two lines in a new test in QTP and run it. After a successfull run, check you C: drive for excel file named name.xls

DataTable.GlobalSheet.AddParameter "Name", "Sachin"
DataTable.ExportSheet "C:\name.xls" ,1

88. How many ways we can parameterize data in QTP?

http://qtp.blogspot.com/2007/05/parameterizing-tests-in-qtp-quicktest.html

89. What is the Diff between Image check-point and Bit map Check point?

http://qtp.blogspot.com/2007/09/image-bitmap-checkpoint-difference.html

90. In how many ways we can add check points to an application using QTP.

You can manually add checkpoint to your test.
You can use CheckProperty.
You can use CheckItemProperty.
You can add a checkpoint while creating (recording) your test.
You can add a checkpoint while modifying (editing) your test and so on...is this the end? what say?

91. How Does Run time data (Parameterization) is handled in QTP?

w.r.t. for example datatable, you can use DataTable object (which is The run-time Data Table) and all its methods and properties etc. etc.

92. Give the reasons to use breakpoint?

1. suspend a run session and inspect the state of your application
2. mark a point from which to begin stepping through a component or function library using the step commands

93. What is the Active screen?

Active Screen. Provides a snapshot of your application as it appeared when you performed a certain step during the recording session.

94. Explain what is a test suite?

In software development, a test suite, less commonly known as a validation suite, is a collection of test cases that are intended to be used to test a software program to show that it has some specified set of behaviours. A test suite often contains detailed instructions or goals for each collection of test cases and information on the system configuration to be used during testing. A group of test cases may also contain prerequisite states or steps, and descriptions of the following tests. (Wikipedia)

95. Tell whether Business Process Testing can be used for manual testing or not?

Yes

96. What is an Application Area?

The application area contains all of the required resource files and settings that are specific to a particular area of the application being tested. Associating each component with an application area enables the component to access these resources and settings.

97. What is the custom object?

may be which are made according to the specifications of an individual application

98. What is the use of Add-Ins?

QuickTest Professional includes built-in support for testing standard
Windows applications. You can install and load add-ins from the QuickTest
Professional setup, enabling QuickTest to recognize objects in the
corresponding development environments and to provide functionality
appropriate for that environment.
When you work with these add-ins, you can use special methods, properties,
and various special options to create the best possible test or component for
your application.

99. What are the differences between Global sheet and Local sheet?

Global Data Table parameters take data from the Global sheet in the Data Table. The Global sheet contains the data that replaces global parameters in each iteration of the test. By default, the test runs one iteration for each row in the Global sheet of the Data Table.

Local Data Table parameters take data from the action's sheet in the Data Table. The data in the action's sheet replaces the action's Data Table parameters in each iteration of the action. By default, actions run only one iteration.

100. When to use recovery scenarios?

Recovery scenarios are intended for use only with events that you cannot predict in advance e.g Unexpected events, errors, and application crashes etc.

You can download Complete List of questions here.

Wednesday, August 1, 2007

How to call Class inside 1 more Class and use it in Automation script

Class 1

On Error Resume Next
ExecuteFile "C:\Arun\testing.class"
if Err.Number <> 0 then
Reporter.ReportEvent micFail,"AccountAllocation.class", Err.Description
end if
Err.Clear

Class Main

private objTesting

private sub Class_Initialize()
objTesting=null
End Sub

public function getTestingReference
Set objTesting = New Testing
set getTestingReference= objTesting
end function

'Set objTesting = New Testing

'Call objTesting.add1


End Class


Class 2
Class Testing

Private a

Private Sub Class_Initialize()
a=null
end Sub

Public function Add1()
msgbox "inside"
End function

End Class

Script



'On Error Resume Next
ExecuteFile "C:\Arun\main.class"
if Err.Number <> 0 then
Reporter.ReportEvent micFail,"AccountAllocation.class", Err.Description
end if
Err.Clear


'private objTesting

' set getTestingReference = objTesting

Set objMain = New Main

'Call objTesting.add1
Set objTesting=objMain.getTestingReference


objTesting.add1

Problems with QTP

Problems with QTP

1)
QTP has some issues in identifying object in Descriptive programming..

mainly for "Class Name" we should use micclass
like wise some more properties are available

2)

While debugging QTP scripts from QC, some time QTP will get hangged.., it is a known issue and even mercury knows about it.
it happends even in 9.1 also

3)Check points...
Checkpoints are hidden inside OR file and we dont have option of exporting / importing from 1 place to other.. if we change approach it will land in problem

4)
Problem in identifying objects in case of very think client. some time identifying objects will be problem .. specialy for list objects..in Java env

5)
QTP doesn't support drag and drop objects on web

6)

QTP doen't record any objects from pdf file

7)

QTP result generation is not user friendly

spell check

Function CheckSpellErrors(Var)
Set obj = CreateObject("Word.Application")
obj.WordBasic.FileNew
obj.WordBasic.Insert Var
Set SpellErrCollection = obj.ActiveDocument.SpellingErrors
For each element in SpellErrCollection
CreateObject("wscript.shell").popup element,1,"Spell Error"
Next
NoofErrors = obj.ActiveDocument.SpellingErrors.Count
obj.Documents.Close (False)
obj.Quit
Set SpellErrCollection = Nothing
Set obj = Nothing
CheckSpellErrors = NoofErrors
End Function

Msgbox "Spell Error Count = "&CheckSpellErrors("Checki spelling Usingg Automated Testingz")

Friday, July 6, 2007

User defined Result file

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Delcaration of Constans and Variables
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public g_sFileName 'Report Log File Name.
Public g_iCapture_Count 'Number of Images captured
Public g_iImage_Capture 'Flag for Image Capture in Result File
Public g_iPass_Count 'Pass Count
Public g_iFail_Count 'Fail Count
Public g_tStart_Time 'Start Time
Public g_tEnd_Time 'End Time

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Procedure to Open a HTML File for Report Log
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Public Sub rep_Open_File(sFileName, iImageCapture)
Dim g_objReport 'File Object
Dim g_objFS 'File System Object

g_iPass_Count = 0
g_iFail_Count = 0
g_sFileName = sFileName
g_iImage_Capture = iImageCapture
Set g_objFS = CreateObject("Scripting.FileSystemObject")
Set g_objReport = g_objFS.OpenTextFile(g_sFileName, 2, True)
g_objReport.Write "<$$HTML><$$BODY><$$TABLE BORDER=0 CELLPADDING=3 CELLSPACING=1 WIDTH=100%>"
g_objReport.Write "<$$TR COLS=2><$$TD BGCOLOR=WHITE WIDTH=6%><$$IMG SRC='https://webaccess.kdc.capitalone.com/GetAccess/images/logo_sso.gif'><$/$TD><$$TD WIDTH=94% BGCOLOR=WHITE><$FONT FACE=VERDANA COLOR=NAVY SIZE=2><$$B> Helix ProphIT Automation - " & Date & " - " & Time & " on Machine " & Environment.Value("LocalHostName") & "<$$/B><$$/FONT><$$/TD><$$/TR><$$/TABLE>"
g_objReport.Write "<$$TABLE BORDER=0 BGCOLOR=BLACK CELLPADDING=3 CELLSPACING=1 WIDTH=100%>"
g_objReport.Close
Set g_objFS = Nothing
Set g_objReport = Nothing
g_tStart_Time = Now()
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Procedure to Insert a Section to Report Log
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Public Sub rep_Insert_Section(sSection)
Dim g_objReport 'File Object
Dim g_objFS 'File System Object
Set g_objFS = CreateObject("Scripting.FileSystemObject")
Set g_objReport = g_objFS.OpenTextFile(g_sFileName, 8, True)
g_objReport.Write "<$$TR><$$TD COLSPAN=6 BGCOLOR=#66699><$$FONT FACE=VERDANA COLOR=WHITE SIZE=2><$$B>" & sSection & "<$$/B><$$/FONT><$$/TD><$$/TR>"
g_objReport.Write "<$$TR COLS=6><$$TD BGCOLOR=#FFCC99 WIDTH=25%><$$FONT FACE=VERDANA COLOR=BLACK SIZE=2><$$B>Description<$$/B><$$/FONT><$$/TD><$$TD BGCOLOR=#FFCC99 WIDTH=25%><$$FONT FACE=VERDANA COLOR=BLACK SIZE=2><$$B>Expected Result<$$/B><$$/FONT><$$/TD><$$TD BGCOLOR=#FFCC99 WIDTH=25%><$$FONT FACE=VERDANA COLOR=BLACK SIZE=2><$$B>Actual Result<$$/B><$$/FONT><$$/TD><$$TD BGCOLOR=#FFCC99 WIDTH=25%><$$FONT FACE=VERDANA COLOR=BLACK SIZE=2><$$B>Result<$$/B><$$/FONT><$$/TD><$$TD BGCOLOR=#FFCC99 WIDTH=7%><$$FONT FACE=VERDANA COLOR=BLACK SIZE=2><$$B>Test Type<$$/B><$$/FONT><$$/TD><$$/TR>"
g_objReport.Close
Set g_objFS = Nothing
Set g_objReport = Nothing
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Procedure to Insert a Step to Report Log
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Public Sub rep_Insert_Step(sDesc)
Dim g_objReport 'File Object
Dim g_objFS 'File System Object
Set g_objFS = CreateObject("Scripting.FileSystemObject")
Set g_objReport = g_objFS.OpenTextFile(g_sFileName, 8, True)
g_objReport.Write "<$$TR><$$TD BGCOLOR=#EEEEEE COLSPAN=5><$$FONT FACE=VERDANA SIZE=2><$$B>" & sDesc & "<$$/B><$$/FONT><$$/TD><$$/TR>"
g_objReport.Close
Set g_objFS = Nothing
Set g_objReport = Nothing
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Procedure to Insert a Result to Report Log
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Public Sub rep_Insert_Result(sDesc, sExpected, sActual, sResult, sTestType)
Dim g_objReport 'File Object
Dim g_objFS 'File System Object
Dim l_sFile 'Bitmap File Name

Set g_objFS = CreateObject("Scripting.FileSystemObject")
Set g_objReport = g_objFS.OpenTextFile(g_sFileName, 8, True)

If sResult="PASS" Then
g_iPass_Count = g_iPass_Count + 1
If g_iImage_Capture=2 Then
l_sFile = Environment("ResultDir") & "\Screen" & g_iCapture_Count & ".png"
Desktop.CaptureBitmap l_sFile
g_iCapture_Count = g_iCapture_Count + 1
g_objReport.Write "<$$TR COLS=5><$TD BGCOLOR=#EEEEEE WIDTH=25%><$$FONT FACE=VERDANA SIZE=2>" & sDesc & "<$$/FONT><$$/TD><$$TD BGCOLOR=#EEEEEE WIDTH=25%><$$FONT FACE=VERDANA SIZE=2>" & sExpected & "<$$/FONT><$$/TD><$$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=WINGDINGS SIZE=4>2<$/FONT><$FONT FACE=VERDANA SIZE=2><$A HREF='" & l_sFile & "'>" & sActual & "<$/A><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=7%><$FONT FACE='WINGDINGS 2' SIZE=5 COLOR=GREEN>P<$/FONT><$FONT FACE=VERDANA SIZE=2 COLOR=GREEN><$B>" & sResult & "<$/B><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=18%><$FONT FACE=VERDANA SIZE=2>" & sTestType & "<$/FONT><$/TD><$/TR>"
Reporter.ReportEvent micPass,sDesc,sActual
Else
g_objReport.Write "<$TR COLS=5><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sDesc & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sExpected & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sActual & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=7%><$FONT FACE='WINGDINGS 2' SIZE=5 COLOR=GREEN>P<$/FONT><$FONT FACE=VERDANA SIZE=2 COLOR=GREEN><$B>" & sResult & "<$/B><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=18%><$FONT FACE=VERDANA SIZE=2>" & sTestType & "<$/FONT><$/TD><$/TR>"
Reporter.ReportEvent micPass,sDesc,sActual
End If
ElseIf sResult="FAIL" Then
g_iFail_Count = g_iFail_Count + 1
If g_iImage_Capture=1 Or g_iImage_Capture=2 Then
l_sFile = Environment("ResultDir") & "\Screen" & g_iCapture_Count & ".png"
Desktop.CaptureBitmap l_sFile
g_iCapture_Count = g_iCapture_Count + 1
g_objReport.Write "<$TR COLS=5><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sDesc & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sExpected & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=WINGDINGS SIZE=4>2<$/FONT><$FONT FACE=VERDANA SIZE=2><$A HREF='" & l_sFile & "'>" & sActual & "<$/A><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=7%><$FONT FACE='WINGDINGS 2' SIZE=5 COLOR=RED>O<$/FONT><$FONT FACE=VERDANA SIZE=2 COLOR=RED><$B>" & sResult & "<$/B><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=18%><$FONT FACE=VERDANA SIZE=2>" & sTestType & "<$/FONT><$/TD><$/TR>"
Reporter.ReportEvent micFail,sDesc,sActual
Else
g_objReport.Write "<$TR COLS=5><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sDesc & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sExpected & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sActual & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=7%><$FONT FACE='WINGDINGS 2' SIZE=5 COLOR=RED>O<$/FONT><$FONT FACE=VERDANA SIZE=2 COLOR=RED><$B>" & sResult & "<$/B><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=18%><$FONT FACE=VERDANA SIZE=2>" & sTestType & "<$/FONT><$/TD><$/TR>"
Reporter.ReportEvent micFail,sDesc,sActual
End If
Else
g_objReport.Write "<$TR COLS=5><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sDesc & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sExpected & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=25%><$FONT FACE=VERDANA SIZE=2>" & sActual & "<$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=7%><$FONT FACE='WINGDINGS 2' SIZE=5 COLOR=RED>O<$/FONT><$FONT FACE=VERDANA SIZE=2 COLOR=BLACK><$B>" & sResult & "<$/B><$/FONT><$/TD><$TD BGCOLOR=#EEEEEE WIDTH=18%><$FONT FACE=VERDANA SIZE=2>" & sTestType & "<$/FONT><$/TD><$/TR>"
Reporter.ReportEvent micGeneral,sDesc,sActual
End If

g_objReport.Close
Set g_objFS = Nothing
Set g_objReport = Nothing
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Procedure to Close Report Log
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Public Sub rep_Close
Dim g_objReport 'File Object
Dim g_objFS 'File System Object
Set g_objFS = CreateObject("Scripting.FileSystemObject")
Set g_objReport = g_objFS.OpenTextFile(g_sFileName, 8, True)
g_tEnd_Time = Now()
g_objReport.Write "<$TR COLS=5><$TD BGCOLOR=BLACK WIDTH=25%><$FONT FACE=VERDANA COLOR=WHITE SIZE=2><$B>Pass Count : " & g_iPass_Count & "<$/B><$/FONT><$/TD><$TD BGCOLOR=BLACK WIDTH=25%><$FONT FACE=VERDANA COLOR=WHITE SIZE=2><$B>Fail Count : " & g_iFail_Count & "<$/B><$/FONT><$/TD><$TD BGCOLOR=BLACK WIDTH=25%><$FONT FACE=VERDANA COLOR=WHITE SIZE=2><$B>Time Taken : " & DateDiff("n",g_tStart_Time,g_tEnd_Time) & " Minutes<$/B><$/FONT><$/TD><$TD BGCOLOR=BLACK WIDTH=7%><$FONT FACE=VERDANA COLOR=WHITE SIZE=2><$B><$/B><$/FONT><$/TD><$TD BGCOLOR=BLACK WIDTH=18%><$FONT FACE=VERDANA COLOR=WHITE SIZE=2><$B><$/B><$/FONT><$/TD><$/TR>"
g_objReport.Write "<$/TABLE><$/BODY><$/HTML>"
g_objReport.Close
Set g_objFS = Nothing
Set g_objReport = Nothing
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' About : Procedure to Show Report Log in Browser Window
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Public Sub rep_Show_Result
rep_Close
Set objIE = CreateObject("InternetExplorer.Application") ' Creating a new object for IE
objIE.Visible = True 'Setting the visible property to true
'msgbox g_sFileName & "#Summary"
objIE.Navigate g_sFileName & "#Summary"
End Sub

Synchronise Objects function

//Synchronise Objects function - another

Public Function fnSynchroniseObjects(objPage,objObjectToSynchronise,intWaitValue)

Dim blnResult

blnWaitProprtyValue=CBool(blnWaitProprtyValue)
intWaitValue=(Int(intWaitValue)*1000)
objPage.Sync

objObjectToSynchronise.WaitProperty "visible", True , intWaitValue

objObjectToSynchronise.WaitProperty "attribute/readyState", "complete", intWaitValue

End Function

verify the Heading text in a Frame

'' Name : fnVerifyHeadingText(objFrame, strHeading)
'' Description: This function is used to verify the Heading text in a Frame
'' Arguments :
'' objFrame: Frame object in which the heading is present
'' strHeading: Heading String
'' Return: True/False
'' Pre-Condition:The frame containing the heading should be displayed
'' Post-condition:
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Public Function fnVerifyHeadingText(objFrame, strHeading)

Dim objDescWebElem, objWEHeading

fnVerifyHeadingText = True
'''''''''' Creating a web element object for Heading'''''''''''''
Set objDescWebElem = Description.Create()
objDescWebElem("micclass").Value = "WebElement"
objDescWebElem("innertext").Value = Trim(strHeading)
objDescWebElem("outertext").Value = Trim(strHeading)
objDescWebElem("html tag").Value="SPAN"

''''''''''Verify Heading''''''''''''''''''''''''''''''''
If objFrame.Exist(4) Then
Set objWEHeading = objFrame.ChildObjects(objDescWebElem)
If (objWEHeading.Count <= 0) Then
fnVerifyHeadingText = False
End If
Else
fnVerifyHeadingText = False
End If

End Function