Showing posts with label Quick Test Professional. Show all posts
Showing posts with label Quick Test Professional. Show all posts

Friday, January 28, 2011

QuickTest Professional Object Model Reference - Utility Statements

Describe Result :-

Return the text description of the error message
Code:-
oBjError = getlasterror
Msgbox (describeresult(oBjError))

ExecuteFile :-

User can call the following format using “ExecuteFile”command in the script level .vbs .txt and .qfl
Code:-
ExecuteFile “FileLocation & file Name”
Note:- Execute file can also call files which is attached in QC also
ExecuteFile ("[QualityCenter] Subject\FileName.vbs")

Exit Action :-

User can call the action based on the function flow or requirement; in meanwhile like to stop the execution of the action we can also use the Exit Action command
Code:-
If RunStatus = “Y” then
Call Runaction "vinodh", "oneIteration"
Else
Exit Action (return Value)
End if
Note:- Return Value populated in the Test result in Quick Test

ExitActionIteration :-

It’s will stop iteration of the function flow
Code :-
If CITY = “USA” then
Call Runaction "vinodh", "oneIteration"
Else
ExitActionIteration(return Value)
End if
Note:- Return Value populated in the Test result in Quick Test

ExitComponent :-

Function used for BPT Testing, exit for the current component run
Code:-
If res = False Then
ExitComponent (return Value)
End If
Note:- Return Value populated in the Test result in Quick Test

ExitComponentIteration :-

Function used for BPT Testing, exit for the current iteration
If res = False Then
ExitComponentIteration(return Value)
End If
Note:- Return Value populated in the Test result in Quick Test

ExitTestIteration :-

Exit current iteration of the Quick Test, Quality centre and BPT component also
If res = False Then
ExitTestIteration (return Value)
End If
Note:- Return Value populated in the Test result in Quick Test

InvokeApplication:-
Invoke the executable application like exe file
Code:-
InvokeApplication "E:\Program Files\Microsoft Internet\IEXPLORE.EXE"

LoadAndRunAction:-

Load the specific action when user require to run the action
Code :-
If CITY = “USA” then
LoadAndRunAction (“Path”,”ActionName”,”Iteration”)
Else
Exit test
End if

Print :-

Display the runtime value from the application
Code:-
Print "VariableName"

Tuesday, January 4, 2011

Quick Test Object Reference Model

Crypt Object – Encrypt Method  
          Encrypt the string variable using Encrypt Method Ex: User can use the Password for securities

Pwd = "vinodh"
Cpwd = Crypt.Encrypt (Pwd)
Msgbox Cpwd

Data Table Method
          Quick Test have feature to create the multiple test data and stored in the Data Table and handled in the runtime.  Scripts will store the temporally in the Data table; User can see the test data in the QT Result window    

Addsheet Method
          Run time user can add the new sheet with test data  
Ex:
a = Datatable.AddSheet("Vino").AddParameter("Name","Check")
print a

Export Method
          Quick Test store the test data value into excel format based on the location
Ex:
a = Datatable.AddSheet("Vino").AddParameter("Name","Check")
print a
DataTable.Export("C:\Vinodh\TestLog.xls")

Delete Method
          Delete the sheet while running the test data table Index value is :1
Ex:
a = Datatable.AddSheet("Vino").AddParameter("Name","Check")
print a
DataTable.DeleteSheet("Vino")

ExportSheet Method

          Export the specific test data sheet from the runtime data table
Index value is : 1

a = Datatable.AddSheet("Vino").AddParameter("Name","Check")
print a
DataTable.ExportSheet "C:\Vinodh\TestLog.xls",3


GetRowCount Method
          Return the total no of the row available in this particular sheet
a = Datatable.AddSheet("Vino").AddParameter("Name","Sona")
print a
ss = Datatable.GetSheet("Vino").GetRowCount
print ss

GetSheet Count Method
          Return the number of sheet count available in excel sheet
DataTable.Export("C:\Vinodh\TestLog.xls")
sheetcount = DataTable.GetSheetCount
print sheetcount


Monday, November 29, 2010

Find the Excel Prodcut Code, Version,UseSystem Separators, Default File Path

Dim ExcelVersion as string


ExcelVersion = CreateObject("Excel.Application").ProductCode

Msgbox ExcelVersion

Dim ExcelVersion as string

ExcelVersion = CreateObject("Excel.Application").Version

Msgbox ExcelVersion

Dim ExcelVersion as string

ExcelVersion = CreateObject("Excel.Application").UseSystemSeparators

Msgbox ExcelVersion


Dim ExcelVersion as string

ExcelVersion = CreateObject("Excel.Application").DefaultFilePath

Msgbox ExcelVersion

Raise the defect from QTP

Dim TDConnection


Set TDConnection = CreateObject("TDApiOle80.TDConnection")

TDConnection.InitConnection "http://10.128.76.242:8080/qcbin" ' URL for the DB

TDConnection.ConnectProjectEx "DomainName","ProjectName","UserName","Password "

If TDConnection.Connected Then

MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName + chr (13) +"Project " + TDConnection.ProjectName )

'Get the IBugFactory

Set BugFactory = TDConnection.BugFactory

'Add a new empty bug

Set Bug = BugFactory.AddItem (Nothing)

Bug.field ("BG_STATUS") = "New"

' BG_RESPONSIBLE

Bug.field ("BG_PROJECT") = "Testing"

Bug.field ("BG_SUBJECT") = "Automation Testing"

Bug.field ("BG_SUMMARY") = "Automation Testing"

Bug.field ("BG_DESCRIPTION") = "QTP create the Defect Log for Automation Testing"

' BG_DEV_COMMENTS

Bug.field ("BG_SEVERITY") = "Severity 4"

Bug.field ("BG_PRIORITY") = "Low"

Bug.field ("BG_DETECTED_BY") = "UserNAme"

Bug.field ("BG_USER_01") = "Raised"

Bug.field ("BG_USER_02") = "Cycle 0"

Bug.field ("BG_USER_06") = ""

Bug.field ("BG_USER_09") = "1375484"

Bug.field ("BG_USER_10") = "SIT"

Bug.field ("BG_USER_11") = "Automation"

Bug.field ("BG_USER_12") = "Others"

Bug.field ("BG_USER_15") = "IN"

Bug.Post

Else

MsgBox("Not Connected")

End If

Thursday, June 17, 2010

Explain the difference between Keyword view and Expert view

Keyword view:

Keyword is a table view structure, it represent for each row for part of the action. It contain following view as below like “item, operation, value, documentation, assignment and comments “

Item
Represent hierarchical tree view of the Test object within the table. It contains following items available on
·         Test object
·         Utility object
·         Function call
·         Statement




Operation 

What operation should be performed for each test objects in the table view like..
·         Run
·         Set
·         Secure
·         Enter
·         Type
·         Select
·         Close


Value
File location, Path , Value, Inputs of the each Test objects








Documentation
It will capture the file location; Test objects inputs and each to understand the each test objects what does for the test objects in the application

Expert View:

QTP displays each step as a VBScript line or statement. In object-based steps, the VBScript statement defines the object hierarchy
Note: Test object and method names are not case sensitive
The following diagram shows how the same object hierarchy is displayed in the Expert View and in the Keyword View


Wednesday, June 16, 2010

Descriptive Programming in QTP

Object Repository:
Ø  OR is a place to stores QTP learned objects
Ø  QTP uses default Object Identification properties: mandatory and assistive to learn objects into OR
Script play back using OR
-          QTP find the Objects in OR using Logical name and Object hierarchy
-          QTP retrieve the test object properties from OR
-          QTP search the application for the object with the same object in OR and perform the user action
Descriptive Programming:
v  Learn the object Properties and physical description of the objects and used into Script level
v  Descriptive properties is store Script level

Script play back using Descriptive programming
-          QTP search the AUT for the Object using Descriptive properties and performs user action
How to use the Descriptive programming
They are two ways in which descriptive programming can be used as below

1)    By creating properties for collection of Objects or Child Objects
    We can use description object to get all the objects on the page that matches that specific description. Suppose we have to check all the checkboxes present on a web page. So we will first create an object description for a checkbox and then get all the checkboxes from the page

Dim obj_ChkDesc
Set obj_ChkDesc=Description.Create
obj_ChkDesc(“html tag”).value = “INPUT”
obj_ChkDesc(“type”).value = “checkbox”
Dim allCheckboxes, singleCheckBox
Set allCheckboxes = Browse(“Browser”).Page(“Page”).ChildObjects(obj_ChkDesc)
For each singleCheckBox in allCheckboxes
             singleCheckBox.Set “ON”
Next

2)    By creating properties for Single Objects
        When going for single or specific point within a test object hierarchy, you must create descriptive properties from starting onwards
For Example,
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "vinodh"
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Type  micTab
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "4c18d6c06f2d8fe29ad434c54106936bc9199553"
Dialog("text:=Login").WinButton("regexpwndtitle:=OK").Click
Window("text:=Flight Reservation").Close
Note: If initially of the code used OR objects after that, if used descriptive properties, QTP doesn’t recognize  the objects
For example
Dialog("text:=Login").WinButton("OK").Click
Error:

QTP support following applications for Automation

Default Add-ins
v  ActiveX
v  Visual basic
v  Web
Other Add-Ins
v  Siebel
v  Java
v  SAP
v  Oracle
v  Delphi
v  .Net 

Names of the Products and Vendor for Automation tools

Tool Name
Company Name
Latest Version
HP
10
IBM Rational
8.1.0.3
IBM Rational
2001
OpenSource Tool
1.0.6
Micro Focus
2009
AutomatedQA
7.52
Micro Focus
6.3
WATIR
Open Source tool
1.6.5

The benefits of Effective Test Automation

1) Cost Effective
2) Time is saved
3) Reusable the automation scripts
4) Human resources is reduce
5) Support the Development process

Object Spy in QTP

Object spy pointing mechanism for view the supported properties and methods of spy objects. Click on the “Hand symbol” button and select the window or object , it will display the Properties and value of the objects

There are two ways to Spy the objects in QTP
1) Choose Tools-> Object Spy
2) Object repository Dialog

Note:- The Application or object is not visible, hold the Ctrl button and Click or activate the required window to and release the Ctrl button

Object repository in QTP

Understand the Object Repository:
          While Record the Application, Manually Define or Add the Objects it stored into Object Repository. All Objects displayed in the tree view
v  Name:- Name of the Objects
v  Class: Class of the objects
v  Repository : Repository location and Default like “ Local”
v  Test Object details:
v  Description Properties: View/Modify the object’s properties and property value.
v  Ordinal Identifier : It indicate the Identifier Type – Location or Index  and Value 0(Default value)
v  Additional details : it will display Smart Identification is disable or enable and comments
Add the Objects into OR
v  Ctrl+ R (or) Resources -> Object Repository. Select  “Add object to Local” button, highlight the application or window, it will capture all the objects and stored into Object Repository 

Tuesday, June 15, 2010

Recovery scenario manager for QTP

Unexpected events, errors, and application crashes during a running session can disrupt your application and execution section. This is a problem particularly when tests run unattended window or pop-up or Notification. The test pauses until you perform the operation needed to recover.

QTP enables you to create recovery scenarios and associate them with specific tests. Recovery scenarios activate specific recovery operations when trigger events occur.

Define the Recovery scenario
1.    Trigger Event:-
      Pop-up window:-Pops up window an opened the applications during the test run
               Object State: - Object identification issue in our application not match specified value
               Test Run:- Step in your test does not run successfully
               Application crash: Open applications fails during the run times

2.    Recovery Event
     Select the operation to perform when the trigger event occurs
Operation type
               Keyboard or Mouse Operation
               Close application process
               Function call
               Restart the OS (windows)

3.    Post Recovery Event
The recovery operations have been performed and which point in the test or QTP should be continue, the following steps are available in QTP like
     Repeat current Step and Continue
     Proceed to next step
     Proceed to next action or component iteration
     Proceed to next test iteration
     Restart current test run
     Stop the test run

Finally entered the recovery scenario name and saved the operation

Features & Benefits of Quick Test Professional


  • ·         Key word driven and Expert view testing
  • ·         Suitable for both client server, web based application, Oracle Apps, SAP
  • ·         Handling object using Object Repositions manager
  • ·         Descriptive Programming
  • ·         Script language for VB scripts
  • ·         Error handling mechanism
  • ·         Excellent data driven testing features using external File like Excel and Notepad
  • ·         Object Spy and Object Identification feature
  • ·         Verify the file ,text, image and data from database using check points
  • Recovery scenario