Thursday, November 10, 2011

How to use the FireEvent method when a click does not work

Overview: While using QTP’s click method on a search WebElement earlier today, I had an issue with a WebTable’s populate event not being triggered as it should have. If you ever experience a similar problem with your application (not performing an expected action after a certain event occurs), don’t give up – and be sure to try the FireEvent method. Description: The FireEvent method is designed to trigger events in an application. Syntax: The Syntax for the FireEvent is: yourObject.FireEvent EventName,[x-optional],[y-optional],[BUTTON-optional] Valid Events: The events available when using the FireEvents method are:
  • onchange
  • onclick
  • ondblclick
  • onblur
  • onfocus
  • onmousedown
  • onmouseup
  • onmouseover
  • onmouseout
  • onsubmit
  • onreset
  • onpropertychange
The click method below was not working: 
Set mainPath = browser("CB").Page("CB")mainPath.WebElement("Search").Click 
but using the FireEvent did work: 
mainPath.WebElement("Search").FireEvent "ondblclick"

What is DOM? and How to use DOM properties in QTP?

What is DOM?

The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. Aspects of the DOM (such as its "Elements") may be addressed and manipulated within the syntax of the programming language in use. The public interface of a DOM is specified in its application programming interface (API).

how the browser display's objects in the browser
  DOM
   |-> Window
       |-> Document
             |-> Anchor
             |-> Link
             |-> Form
                  |-> Text-box
                  |-> Text Area
                  |-> Radio Button
                  |-> Check Box
                  |-> Select
                  |-> Button


QTP will be able to access to Internet Explorer Document Object Model (DOM) through which we will be able to access the HTML tags directly. Access to the DOM is performed using the .Object notation.

below function explains how to iterate all the tags in an Internet Explorer page. The function then outputs the inner-text of the tags (the text contained between the tags) to the Test Results using the Reporter object.

' we are using On Error Resume Next option because all the page elements might not have inner-text. 
 On Error Resume Next 
 Set Doc = Browser("CNN Interactive").Page("CNN Interactive").Object 
 ' Loop through all the objects in the page. 
 For Each Element In Doc.all 
 TagName = Element.TagName ' Get the tag name. 
 InnerText = Element.innerText ' Get the inner text. 
 ' Write the information to the test results. 
 Reporter.ReportEvent 0, TagName, InnerText

QTP 11 Now Supports Google Chrome

Wow what a great news now QTP 11  Supports GOOGLE Chrome !!!!!!!!!!!!!!!!!


HP Patch QTPWEB_00088 features and limitations

HP just released a new patch QTPWEB_00088 that contains the following features and limitations:

QTP does not support recording steps in Google Chrome

Certain Google Chrome Javascript functionality, like web pages that use JSON objects, may cause unexpected behavior in QTP.
If you manually uninstalling the QTP agent extension from Tools>Extensions, you must manually reinstall it if you reinstall this patch.
Browser methods will not be supported

Also the following methods are not supported:

Browser.Home
Brpwser.Fulscreen
Browser.ClearCache
Browser.Objects
Running steps not supported:

Chrome: //* pages
Multiple tabs
Multiple browsers
Web pages that include frame sets
WebXML test objects
Web test objects located inside iFrame controls with a'blank' or 'about:blank 'SRC in property value
Developers Tools Pane but running against Google Chrome while the developers tools pane is open is supported
Web 2.0 test objects or Web Extensibility-based test objects
Web-based env, such as SAP Web, Siebel, Java, .NET Webforms etc..

Click here to Download QTPWEB_00088 Patch

Thanks to Joe for such valuable information http://www.joecolantonio.com/2011/11/02/qtp11-now-supports-google-chrome-patch-qtpweb_00088/ 

Friday, October 14, 2011

Close all Browsers Opened Except QC

Dim intIndex
Set oDesc=Description.Create
oDesc("micclass").Value="Browser"
intIndex=0
While Browser("micclass:=Browser","index:="&intIndex).exist(0) and intIndex<Desktop.ChildObjects(oDesc).count
If instr(1, Browser("micclass:=Browser","index:="&intIndex).getRoProperty("name"),"Quality Center") = 0 Then
SystemUtil.CloseProcessByHwnd( Browser("micclass:=Browser","index:="&intIndex).getRoProperty("hwnd"))
else
intIndex=intIndex+1
End if
wend

How to Search for a particular value in Excel ?

Using the below script, we will be able to search a particular value in the excel file.

*******************************************************************************************

Set appExcel = CreateObject("Excel.Application")
appExcel.visible=true
 Set objWorkBook = appExcel.Workbooks.Open (filepath) 'opens the sheet

 Set objSheet = appExcel.Sheets("Sheet1)' To select particular sheet
With objSheet.UsedRange ' select the used range in particular sheet
    Set c = .Find ("nn")' data to find  
For each c in objSheet.UsedRange' Loop through the used range
 If c="nn" then' compare with the expected data
            c.Interior.ColorIndex = 40
make the gary color if it finds the data
End If
            Set c = .FindNext(c)' next search
next
End With
objWorkBook.save
objWorkBook.close
set appExcel=nothing

**********************************************************************************************

Thursday, October 13, 2011

Regular Expressions Utility Functions in VB Script

Below are the some of the very important functions using the regular expression in VB Script, which will make your Automation script creation very easy.

"********************************************************************************************
"'Function to check if a string matches a Regular Expression Pattern
"********************************************************************************************
Function IsRegExMatch(strText, regEx_Pattern, blnMatchCompleteString)
Dim oRegExp, retVal
'Create regular expression object.
Set oRegExp = New RegExp
'Set pattern.
oRegExp.Pattern = regEx_Pattern
'Ignore case
oRegExp.IgnoreCase = True
'Match complete string or not
oRegExp.Global = blnMatchCompleteString
'Test the regular expression
IsRegExMatch = oRegExp.Test(strText)
Set oRegExp = Nothing
End Function

"********************************************************************************************
"'Function to Match a Regular Expression and Replace with a particular text if a string matches a regular expression pattern.
"********************************************************************************************
Function RegExMatchandReplace(strText,regEx_Pattern,strReplacementText,blnMatchCompleteString)
Dim oRegExp, retVal,strReplacedText

' Create regular expression object.
Set oRegExp = New RegExp

'Set pattern.
oRegExp.Pattern = regEx_Pattern
'Ignore case
oRegExp.IgnoreCase = True
'Match complete string or not
oRegExp.Global = blnMatchCompleteString

'Test the regular expression
RegExMatch = oRegExp.Test(strText)
If RegExMatch = True Then
strReplacedText = oRegExp.Replace(strText,strReplacementText)
End If
RegExMatchandReplace = strReplacedText
Set oRegExp = Nothing
End Function

"********************************************************************************************
"'Function to Get Total Number of Matches of a Regular Expression Pattern in a particular string
"********************************************************************************************
Function GetRegExMatchCount(strText, regEx_Pattern, blnMatchCompleteString)
Dim oRegExp, retVal
'Create regular expression object.
Set oRegExp = New RegExp

'Set pattern.
oRegExp.Pattern = regEx_Pattern
'Ignore case
oRegExp.IgnoreCase = True
'Match complete string or not
oRegExp.Global = blnMatchCompleteString

'Test the regular expression
RegExpMatch = oRegExp.Test(strText)
If RegExpMatch Then
Set oRegExMatchCount = oRegExp.Execute(strText)
GetRegExMatchCount = oRegExMatchCount.Count
End If
Set oRegExp = Nothing
End Function

"********************************************************************************************
"'Function to Trim white space characters from end of a string
"********************************************************************************************
Public Function RTrimW(ByVal Text)
'String pattern ending with carriage return, tab, new line or a space character
RTrimPattern = "[\s]*$"

Dim oRegExp
Set oRegExp = New RegExp
oRegExp.Pattern =RTrimPattern
oRegExp.Global = False
RTrimW = oRegExp.Replace(Text,"")
Set oRegExp = Nothing
End Function

"********************************************************************************************
"'Function to Trim white space characters from start of a string
"********************************************************************************************
Public Function LTrimW(ByVal Text)
'String pattern ending with carriage return, tab, new line or a space character
LTrimPattern = "^[\s]*"
Dim oRegExp
Set oRegExp = New RegExp
oRegExp.Pattern = LTrimPattern
oRegExp.Global = False
LTrimW = oRegExp.Replace(Text,"")
Set oRegExp = Nothing
End Function

"********************************************************************************************
"Function to Trim white space characters from both start and end of a string
"********************************************************************************************
Public Function TrimW(ByVal Text)
TrimW = LTrimW(RTrimW(Text))
End Function

"********************************************************************************************

Thursday, October 6, 2011

QTP Tricky Questions And Answers

QTP Tricky Questions
  1. How will you automate a window which while spying is not returning any property value??
  2. How do you find the color and font of all the links on the page???
  3. What are the disadvantages of smart identification??
  4. What are the disadvantages of recovery scenario??
  5. How can you execute JavaScript on QTP??
  6. What are the basic prerequisites required in automating an Infragistics controls based application?
  7. Can I record a web based application on Mozilla??
  8. What is the difference between Repository Parameter and Repositories Collection??
  9. How to copy Virtual Object Manager from one computer to another computer??
  10. Can we use GetRoProperty method to get index or location of link in web application??

QTP Tricky Questions Answers fallows!

Answer 1: In QTP point of view we automation applications where there is proper addin. There are few cases where we can use win32 API and shell programming to achieve.
Example: use win32 query to get the handle or processed of the app and use some API to act on it...this will be a work around not a solution.

Answer 2: use DHTML properties ....use object.attributes...u will get all DHTML properties of that particular element in a collection.

Answer 3: There are many out of which is time consuming it eats lot of time and sometimes, it yields wrong results also in case of dynamic environment.

Answer 4: I think Space and time may be the constraints, because I never used it. It is pretty waste of time to use it.

Answer 5:  To execute JavaScript we have to fallow these steps
  1. Open HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration_UI\ScriptMgr
  2. Create a new String value with name AltProgID and value "Mercury.JSScriptMgr" and change the value of "Create" to 1
  3. Create a new child key inside the key                             HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration_UI\ScriptConstants                                                               {0ECD5785-BE7D-11d4-8EAF-11135659EC56}
  4. Repeat the same steps for the below key                           HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration
  5. Open                                                                                                                                C:\Program Files\Mercury Interactive\QuickTest Professional\bin\QTEditor.ini
  6. Add the below parameter to [General options]                                                             AllowJavaScript = 1                                                                                                 DisableVBScript = 1
  7. Done 
Answer 7: U can record but not as a web application but a standard windows application
Example: Window("Mozilla Firefox").WinObject("MozillaWindowClass").Type "sivakumar"

Answer 8: Repository parameters enable you to specify that certain property values should be parameterized, but leave the actual parameterization to be defined in each test that is associated with the object repository that contains the parameterized test object property values.
Repository parameters are useful when you want to create and run tests on an object that changes dynamically.
Repositories collection is a collection object that enables you to programmatically manage the run-time collection of shared object repository files associated with the current action, for more details check QTP Help file.

Answer 9: checkout for .VOT files in dat folder of the installation

Answer 10: NO

Friday, September 2, 2011

How to connect to Quality Center form Quick Test Professional

Quality Center:We can use Quality Center to create a project (central repository) of manual and automated tests and components, build test cycles, run tests and components, and report and track defects. You can also create reports and graphs to help you review the progress of test planning, runs, and defect tracking before a software release. When you work in QuickTest, you can create and save tests and components directly to your Quality Center project. You can run QuickTest tests or components from Quality Center and then use Quality Center to review and manage the results. You can also use Quality Center with Business Process Testing support to create business process tests, comprised of the components you create in either QuickTest or Quality Center with Business Process Testing support.

Advantages of Quality Center:

Quality Center is a single application for complete Test ManagementStarts with Requirements, goes through Test Planning and Test Execution, and on through Defects.Each of these items can be linked or associated with each other.

How to connect to QC form QTP:
with the below simple steps and pictures you will be able to see how we can connect to QC from QTP
1. Open file menu and click on to QC connection and give the QC server url.
 2. Give the user credentials, select the domain, project and close the window

 3. Now your QTP is connected to QC successfully.

now we will see How to upload QTP scripts to QC

1. Open automation script witch you already developed and click on save as.

2. Select the folder name and click on Ok button

Now we will see How to save resource files in QC

1.Open the Resource file from file menu and click on save as..
2. select the folder and click on ok.
Now all are ready in the QC from QTP, we will see how we will Execute Automation script from QC

1. Open QC and go to Test Lab.
2. Create a test set and select the Automation scripts.
3. Click on Run
4. Give Host IP/Name in the Run On Host field or Select Run All Tests Locally check box to run on local host
5.Click on the Launch report to see the QTP report.
Now we will see Batch Run of automation scripts from QC

1. Open QC and go to Test Lab.
2. Create a test set and select the Automation scripts.
3. Click On Run Test Set in QC
4. Give Host IP/Name in the Run On Host field or Select Run All Tests Locally check box to run on local host

All about QTP Descriptive Programming

What is Descriptive Programming?
In QTP if we want to do some actions/operation on an object that is not there in the object repository then we can use or go for Descriptive programming.
With out using QTP OR we can store properties of Test objects in the QTP Script by defining the Object properties.
Advantages of Descriptive Programming:
1. We will be able to work on writing QTP scripts even before the application is NOT available. It will help to increase the utilization of the Automation scripts as it will be immediately available once the application get released.
2.We can define the properties of an object without considering the parent objects in the hierarchy. i-e Object identification will not depend on its parent object.

there are 2 ways to describe your Test Objects.
One is description in form of the string arguments.
For Ex:  text box having html code as < input type=”text” name=”txtUserSiva” > can be accessed as below.
Browser(“Browser”).Page(“Page”).WebEdit(“Name:=txtUserSiva”,”html tag:=INPUT”).set “AutomationTestingwithQTP”.
The 2nd way is using Decription.create as below.
Set objDesc = Description.Create
objDesc(“html tag”).value= “INPUT”
objDesc(“name”).value= “txtUser”
Browser(“Browser”).Page(“Page”).WebEdit(objDesc).set “AutomationTestingwithQTP”.

Disadvantage of Descriptive Programing:
First disadvantage of Descriptive programming is Maintenance will be difficult.
Since Object repository will be stored in centralized place, property definition for any Object can be easily changed at any time if the application developer changes the property of the actual object/control.
But, in descriptive programming (DP) it is difficult to change the object property as each QTP developer will be defining object property in many places using DP.
For example, assume that you and team member are developing automation test scripts for testing gmail application.
Gmail login script will be used in many test scenarios.
Assume that you are automating some scenarios and your team member is automating some other scenarios.
In case of Object Repository, you and your team member will be forced to use same object description for login page controls/Objects (e.g username, password, login button).
So in future if Google changes any property (e.g change the button name from “login” to “get into gmail”), all the scenarios can be easily updated just by updating this change in Object repository.
But in case of DP, there is a possibility of defining the login button in multiple places. One definition by you and another by your team. (Anyway proper Team Coordination will avoid this issue, but practically it is very difficult to achieve this coordination.).
So, comparatively updating DP style coding is bit difficult if the application properties got changed.

Thursday, September 1, 2011

Understanding QTP License Types

Quick Test Professional has 2 types of licenses:

1. Seat License
2. Concurrent License

A trial version of the software is also available for 14 days

Seat License:A seat license is specific to the computer on which it is installed. This license includes a 14-day demo period.

Concurrent License:A concurrent license regulates the number of concurrent HP QTP users and requires installation of a license server from a separate CD-ROM found in the HP QTP package. Concurrent license is purchased seperately from HP and installed on the HP Functional testing Concurent License Server.

Tuesday, August 30, 2011

How to find DataType of a Variable with VBScript?

When you are validating application using our tool QTP, there will be scenarios to check the displayed value in the field is numeric/text/date etc,.The data type of a variable can be identified in two vbscript built-in functions.

1. Vartype
2. Typename

Vartype returns a numeric value indicating the sub datatype of a variable.

The below table contains return values that indicate respective subtypes.
Return Value
SubDatatype
Description
0
vbEmpty
Empty (uninitialized)
1
vbNull
Null (no valid data)
2
vbInteger
Integer
3
vbLong
Long integer
4
vbSingle
Single-precision floating-point number
5
vbDouble
Double-precision floating-point number
6
vbCurrency
Currency
7
vbDate
Date
8
vbString
String
9
vbObject
Automation object
10
vbError
Error
11
vbBoolean
Boolean
12
vbVariant
Variant (used only with arrays of Variants)
13
vbDataObject
A data-access object
17
vbByte
Byte
8192
vbArray
Array

Ex:
Dim x
x=10
msgbox vartype(x) 'Returns 2
In the above table 2 indicates vbInteger datatype.So x is an integer type.

Typename directly returns the name of the Sub Datatype of a variable.
SubDatatype
Description
Byte
Byte value
Integer
Integer value
Long
Long integer value
Single
Single-precision floating-point value
Double
Double-precision floating-point value
Currency
Currency value
Decimal
Decimal value
Date
Date or time value
String
Character string value
Boolean
Boolean value; True or False
Empty
Unitialized
Null
No valid data
< object type >
Actual type name of an object
Object
Generic object
Unknown
Unknown object type
Nothing
Object variable that doesn't yet refer to an object instance
Error
Error


Ex:
Dim x
x=10
msgbox typename(x)  'Returns “Integer”

There are some more VBScript Built-in functions to find whether a variable datatype is specific datatype or not.

IsArray -- Returns a Boolean value indicating whether a variable is an array or not.
IsDate -- Returns a Boolean value indicating whether an expression can be converted to a date.
IsEmpty -- Returns a Boolean value indicating whether a variable has been initialized.
IsNull -- Returns a Boolean value that indicates whether an expression contains no valid data (Null).
IsNumeric -- Returns a Boolean value indicating whether an expression can be evaluated as a number.
IsObject -- Returns a Boolean value indicating whether an expression references a valid Automation object.

Built in functions are available for only these datatypes. You can write built function for every datatype like below…
'@@@@@@@@@@@@@@@@@@@@@@
Function IsString(oValue)
  If vartype(oValue)=8 then
    IsString=true
  Else
    IsString=False
  End If
End Function
'@@@@@@@@@@@@@@@@@@@@@@

Monday, August 29, 2011

How do I sort arrays items using vbscript?

we will be able to sort in alphabetically an array items using the vbscript.

' declaring the array
Dim arrSortOut(10)
' assigning data to the array
arrSortOut(0)="Ammu"
arrSortOut(1)="Siva"
arrSortOut(2)="Madhu"
arrSortOut(3)="Ranga"
arrSortOut(4)="Jagadesh"
arrSortOut(5)="Kumar"
arrSortOut(6)="Praveen"
arrSortOut(7)="Martha"
arrSortOut(8)="Zeebra"
arrSortOut(9)="123Zeebra"
arrSortOut(10)="!123Zeebra"

for i = UBound(arrSortOut) - 1 To 0 Step -1
  for j= 0 to i
    if arrSortOut(j)>arrSortOut(j+1) then
      temp=arrSortOut(j+1)
      arrSortOut(j+1)=arrSortOut(j)
      arrSortOut(j)=temp
   end if
  next
next


for x=0 to 8 UBound(arrSortOut)
 msgbox arrSortOut(x)' to check the items
next

How to Maximize/Minimize a Browser?

you can maximize or minimize your browser (AUT) using the below simple script.

If Browser("abc").Exist Then
    Brw_Hwnd = Browser("abc").GetROProperty("hwnd")
    Set a= Description.Create
    a("hwnd").Value = Brw_Hwnd
    Window(a).Maximize'to maximize application browser
    'Window(a).Minimize' to minimize application browser
End If
Follow Me on Twitter

How to get Tool tip of Images in a web page?

Now it's very easy to get tool tip from an images in the web pages, by using the below script.
Browser("abc").Page("abc").Sync
Set desc_img = Description.Create
desc_Img("html tag").value = "IMG"
Set list_imgs= Browser("abc").Page("abc").ChildObjects(desc_img)
   For i = 0 To list_imgs.Count - 1
     tool_tiptxt= list_imgs(i).GetROProperty("alt")
     If tool_tiptxt <> "" Then
       MsgBox "Tool tip text= " & tool_tiptxt
     End If
  Next

How to get the font color of an item in a WebList ?

with the below simple script you will be able to get font, item name and font color of weblist items.

set Web_list_Items= Browser("abc").Page("abc").WebList("abc").Object.all.tags("option")
For each element in Web_list_Items
   Set style = element.currentstyle
   Item_text_color=style.Color
   Item_text=element.text
   msgbox Item_text_color
   msgbox Item_text
Next

Friday, August 26, 2011

Action Template in QTP

How to create a Action Template in QTP?

Every time you open New script in QTP you will get a blank window in Expert view, but if you want to view the Standard header commented section with the automation Standards, you can create a Template which you can use for all the scripts to view the same set of instructions/Standards, and also you can pass all other team members to use the same.

Just follow the bellow simple steps to create Action Templete....

1. Create a text file with what all things need to be in the script.
2. Save as this text file as ActionTemplate.mst file in the
     C:\Program Files\hp\QuickTest Professional\dat Folder.
3. Now Click on new script in QTP.
     You will get what ever text you have kept in the template !!!!!

Scripting Guidelines or Coding Standards in Test Automation Script

Coding Standards are suggestions that will help you to write QTP Script code using VB Script. Naming conventions for crating QTP Script, objects, variables and procedures. Commenting standard in the scripting, Text formatting and align guidelines for the script.

The main motive for using a regular set of coding Standards is to normalize the structure and coding way of a QTP script or set of scripts, so that you and others team members can easily read and understand the QTP code.
Using good coding standards will results in accurate, readable, and unmistakable QTP Script.
Code that is consistent with other languages like Java script etc,. conventions and as sensitive as possible.

Script Organization


An example of the comment block is as follows:

you can also create a action template, with fallowing information, href="http://automationwithqtp.blogspot.com/2011/08/action-template-in-qtp.html">Click Here to see how to create a action template in QTP.

'Test Script Header
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'@Script Name : < Name of the Script>
'@Script Description : < Description of the Script>
'@Script Author : < Jr.Siva Kumar Eanuga>
'@Email ID: < Shivakumar004@gmail.com>
'@CreationDate : < dd-mm-yyyy>
'@Last Updated Date : < dd-mm-yyyy>
'@PreCondition : < pre requisites to be used for the script>
'@Libraries : < required library files>
'@External Function Reference:
'@DataFiles : < required data files>
'@DtParam : < Name>
'@DtParam : < Name>
'@DtParam : < Name>
'@Modification : < By , Date: >
'@Description: < modification description>
'@Reviewed By : < Sr. Siva Kumar Eanuga>
'@Reviewed Date : < dd-mm-yyyy>
'@Remarks : < Additional information>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
'-- Constant Declarations
'declare here your constants
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'--- Global Variable Declarations
'declare here your Global Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'--- Local Variable Declarations
'declare here your Local Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'< detailed script>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The End of Script
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Standards of Constant Naming

Constant names should be uppercase with underscores (_) between words.
Ex: USER_LIST_MAX, NEW_LINE

Standards of Variable Naming

For easy readability purpose use the prefixes like below examples, along with descriptive names for variables in your QTP Script code.
Ex:
String -- sName
Object -- oObjectname
Integer, Byte, Long -- nNumber
Array -- arrListitems
Boolean -- bYes
Single, Double -- fPrice
DateTime -- dToday
Error -- errResponse
Currency –- cRupees

Object Naming Standards

For the objects we create in the QTP script, we use prefix “o” (small letter o).

Ex:
ADODB.Connection -- oConn
ADODB.Recordset -- oRset
Scripting.xmlobject -- oXmlobj
Scipting.FileSystemObject -- oFsobj
Scipting.TextStream -- oTxt
Scripting.Dictionary -- oDic
Shell.Application -- oWsh
Excel.Application -- oXls

to be continued .....

Thursday, August 25, 2011

How to get Sub-folders Count and Names from a Folder?

How to get Sub-folders Count and Names from a Folder? using the below code(VB Script) you will be able get all the sub-folders in a parent folder.  This code will be very much useful in the during the creation of Test Automation Frame works.


Set Obj = CreateObject("Scripting.FileSystemObject") 
'Creating a file system object
    Set Obj1 = Obj.GetFolder("C:\test")
    Set Obj2 = Obj1.SubFolders
    msgbox Obj2.Count 'displaying count of sub-folders
    For Each Fold_Iteam in Obj2
        Fold_names = Fold_names& Fold_Iteam.name &vbnewline
Next
msgbox Fold_names 'Displaying all sub-folders names

Lock your system after execution of your QTP Script

Now you can lock your system after your QTP batch script/script execution.
use the below code at the end of your script(batch/regular). your system will be automatically locked,once after script executed.
Public Function Lock_your_system()
    Set obj = CreateObject("WScript.Shell")
    sCmnd = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation"
    obj.Run sCmnd, 0, False
End Function

Tuesday, August 23, 2011

HP QTP Certification

HP QTP certification ( HP0-M16) is mainly planned for functional testers, who are interested in to create/develop automation scripts using functional testing tool "Quick Test Professional 9.2."

From August 1st 2010, HP has come up with the New HP QTP Certification v10.0. AIS is for beginner and ASE is advanced level certification level.

New Exam Name is "Exam HPO-M39" – HP QuickTest Professional 10.0 Software.

Exam Preparation Guide from HP is available to

Download Here

and you can follow the simple instructions.The cost of the HP QTP certification now is $150.

Quick Test Professional 11.00



Quick Test Professional 11.00 is available now with the below awesome new features
ØManage Your Test Data
Quality Center (HP Application Lifecycle Management) test configuration functionality enables to determine runtime which data sets to use for your tests execution.
HP ALM test configurations enable:
  • Unbind your data from your tests


  • Share common data sources across different tests

  • Filter your data to fit your testing needs

  • Increase requirements traceability
Test data can be stored in the Quality Center Test Resources module in the form of data table resource files.
Ø Test Your GUI and UI-Less Application Functionality in One Test

QuickTest-Service Test” integration enables to test across the GUI and non-GUI layers of the application.

We can use QuickTest steps to start testing the GUI elements in the application, then call a “Service Test” test to validate service communications (standard Web Services, non-SOAP Web Services, such as REST, etc.), and then step back into your QuickTest GUI testing, all in a single test run.
The results of the QuickTest and Service Test steps are displayed in a unified report in the new Run Results Viewer.
Ø New Run Results Viewer

The new Run Results Viewer provides an Executive Summary page with summary data, pie charts and statistics for both the current and previous runs, a quick link to the previous run results, and more.
The Run Results Viewer displays the results of your run session in a set of panes that you can show, hide, move, dock, and otherwise customize to your needs.
We can install the Run Results Viewer as a standalone installation. This enables you to share the results of your tests with business analysts and developers who do not work with QuickTest.

Ø Help QuickTest Identify Your Objects as a Manual Tester Would – VISUALLY
We can now use visual relation identifiers to identify application objects based on other objects that are always near them.
This enables to create a more reliable identification definition for test objects that are otherwise difficult to differentiate, and to ensure that the identification remains reliable even if the user interface design changes.
The Visual Relation Identifier Dialog Box provides the interface and tools to help to create and verify the visual relation identifier definitions.
Ø Collaborate with Developers to Pinpoint Defects Using Log Tracking
QuickTest's new Log Tracking functionality helps to work with developers to pinpoint the root causes of unexpected behavior of the application during run time.
When we enable log tracking, QuickTest receives the Java or .NET log framework messages from the application and embeds the same with the test run results.
We can click a log message in the results to jump to the relevant step in the run results tree, or we can click a step in the run results tree and view the log message that was generated at the time that the selected step ran. we can also specify that a log message of a particular level (or higher) will caused the test execution.
After you view the results, we can also print or export the log tracking details to a file to show to a developer, or we can provide the developer with the standalone Run Results Viewer installation so that the developer can view and analyze the results directly in their system.
Ø Out-of-the-Box Support for Web 2.0 Toolkit Applications
Now QTP 11.00 provides Web Add-in Extensibility-based add-ins for ASP .NET Ajax, GWT, Yahoo UI, and Dojo Web 2.0 toolkits.
We can use these add-ins just as the regular other add-in. we can also use Web Add-in Extensibility or Extensibility Accelerator to customize the provided support to match our needs.
We can install this add-ins by running the Web 2.0 Toolkit Support Setup from the Add-in Extensibility and Web 2.0 Toolkits option in the QuickTest Professional setup window.
Ø New Web Testing Capabilities
Many new testing capabilities are now available for working with Web-Based applications.
Firefox Testing: We can now record steps on Mozilla Firefox and use the .Object property to access the Firefox DOM.
XPath, CSS, Identifiers: We can add the XPath or CSS identifier properties to instruct QuickTest to identify a Web object in your application based on its XPath location or CSS definition.
Event Identifiers. You can also now use the attribute/* notation in the test object description to identify a Web-based object based on an event associated with that object. For example, we can add attribute/onClick as a property in a WebButton test object description to identify a button that is associated with the onClick event.
Embed or Run JavaScripts in Your Web Pages. You can use the new EmbedScript/EmbedScriptFromFile and RunScript/RunScriptFromFile functions to embed JavaScripts in all loaded browser pages and frames or to run JavaScripts in specific pages. Use these scripts to perform operations on, or retrieve data from, the browser pages in your application.

Ø 
Automatically Parameterize Steps

We can instruct QuickTest to automatically parameterize the steps in our test's actions at the end of a recording session.
This enables us to create actions that can be used for a variety of different purposes or scenarios by referencing different sets of data.

You activate this option by selecting the automatically parameterize steps option in the General tab of the Options dialog box. You can set the option to use Global Data Table Parameters or Test Parameters.


When we stop a recording session while this option is selected, QuickTest replaces the constant values in the test object operation arguments of your steps with either Data Table parameters or action parameters, based on your selection in the Options dialog box.


QuickTest performs this automatic parameterization for all relevant steps in any action in your test, in which you recorded one or more steps during that recording session.


If we work with HP ALM, and we can select the Global Data Table Parameters option, we can map the generated parameters to the column names of a data resource and then use different configurations in your test sets.


If we are working with SAP eCATT and when we select the Test Parameters option, then supply the values for the test parameters from eCATT.


Ø New Silverlight Add-in
You can use the new Silverlight Add-in to test objects in Silverlight 2 and Silverlight 3 applications.

After you install the Silverlight Add-in, it is displayed in the Add-in Manager as a child add-in under the WPF Add-in.
Ø Extend WPF and Silverlight Support

The WPF and Silverlight Add-in Extensibility SDK enables you to develop support for testing third-party and custom WPF and Silverlight controls that are not supported out-of-the-box by the relevant QuickTest add-ins.
You install the WPF and Silverlight Add-in Extensibility SDK from the Add-in Extensibility and Web 2.0 Toolkits option in the QuickTest Professional setup window.
Ø Use Extensibility Accelerator for Web Add-in Extensibility Development

The new Extensibility Accelerator for Functional Testing is a Visual Studio-like IDE that facilitates the design, development, and deployment of Web Add-in Extensibility support.

It provides a user interface and special tools that help you define new test object classes, map those test object classes to the controls in your application, and teach QuickTest how to identify the controls, perform operations on the controls and retrieve their properties.

You install the Extensibility Accelerator from the Add-in Extensibility and Web 2.0 Toolkits option in the QuickTest Professional setup window.
Ø It's Easier Than Ever to Insert Regular Expressions

The Smart Regular Expression list provides syntax hints that make it easier than ever to insert regular expressions into your test steps. It also enables you to access the Regular Expression Evaluator, which lets you test regular expressions to make sure they suit your needs.


Ø 
Load Function Libraries at Run Time

The new LoadFunctionLibrary statement lets you load a function library when a step runs instead of at the beginning of a run session. This means, for example, that you can define conditional steps that use functions from various function libraries, but load only the required function libraries during a run session.

Ø Avoid Downtime Due to License Server Failures

With redundant license servers we can create failover, so that if our main license server fails, other remaining servers maintain availability of your licenses without causing any downtime or loss of licenses for users.
The redundant license server feature is especially useful for enterprise customers who have a large network installation and want to maintain license server backup.
****Reference: HP QTP 11.00 Help
Follow Me on Twitter