Sunday, March 4, 2018

Childobjects and ChildItem methods in UFT

Children:
- Children is used to find similar objects in the page
Ex:
set desc= Create.Description()   
desc("name").value="a1"
desc("micclass").value="link"


Browser("a").Page("b").weblink(desc).click

set O1 = Browser("a").Page("b").Childobjects(desc)

for i =0 to O1.count-1

a= O1(i).GetROProperty("innertext")
msgbox a
Next


Childitem:
Is only for object in WebTable




Debug (line by line) code in UFT

- Use break point to debug the code
- once you apply breakpoint, then you can use step into, step over and step return to line by line execution of code


Thursday, December 24, 2015

New Features in UFT



12/24/2015

Source: http://quicktestprotech.blogspot.com/2014/03/uftqtp-12-new-features.html



Insight feature


Source: http://venkatgn.blogspot.com/2014/03/uft-qtp-115-new-feature-insight-object.html


UFT , QTP 11.5 new feature Insight object recognizing



Understanding Insight Objects in UFT 11.5

QTP 11.5 has new features which I have specified in http://venkatgn.blogspot.in/2013/05/hp-qtp-11.html

Apart from the above specified features one of the most important features is how to recognize the objects in application using “image” of the object rather than the properties of the image.

The below navigation explains how the object is recognized using “image” recording in “insight mode”

·         Insight is an image-based identification of object in the application.
·         UFT stores an image of the object with insight test objects (Object Repository) and uses this image as main description property to recognize object in the application.
·         For the objects UFT can also use ordinal identifier to uniquely identify the object if 2 more more same images are there in the same page
·         Visual relation identifier can also be used to identify the object based on its relative position with respect to other near by objects in the application.  (up / left / right / bottom / above)

Adding Insight Objects into object Repository:

UFT allow adding Insight object either in recording Mode or manually in object repository:

1.      Insight Recording: When we start recording in UFT, There is an option to select recording mode. The recording modes in UFT are default, analog, Low Level recording, and Insight recording. When we select recording mode as Insight recording, UFT records object as insight object for images and identifies rest of objects like edit box as window object WinObject and perform action on them.



2.   Insight Objects can be added through Object Repository. Go to Resources>Object Repository. This will open Object Repository window. In Object Repository window, Navigate to Object>Add Insight objects to Local. This can also be added by icon as shown below.
Once we click on Add Insight objects to local, UFT asks to select Learn Mode which can be manual and automatic. Manual Mode provides magnifier to select minute objects in the application.


Adding object from object repository

Options available to work with Insight in UFT 11.5:
UFT 11.5 provides following options for working with insight objects. Options for Insight Object are at Tools>Options>GUI Testing>Insight. This pane enables you to define options that customize how UFT handles Insight test objects when creating test object, and during record and run sessions.
Options to customize the insight object are as follows:
a.   Save the clicked coordinates as the test object’s Click Point when recording a test object.
b.   When recording a test, display mouse operations.
options for insight 

c.   When editing shows test object image in steps and displaying Select learn mode dialog box
d.  Snapshots for insight object takes a lot of disk space, we can provide option to limit test object image, maximum pixels around image, and maximum number of snapshots to save when recording a test object




Source:http://uftquestions.blogspot.com/2014/05/uft-qtp-difference-between-insight.html?showComment=1450982175543#c6826735119712981732


UFT - QTP - Difference between Insight Recording and Low level Recording?


Here are the difference
Insight Recording
Low-Level Recording
Recognizes controls based on their appearance, and not their native propertiesRecognizes every control as Window or WinObject object
Recognizes object based on Image processing TechnologyRecognize object based on X and Y coordinates
Insight recording records parent & child object with relevant test object properties just like normal recording if the object gets recognized with Normal recording and any other objects as InsightObjectUFT records all parent level objects as Window test objects and all other objects as WinObject test objects
Dual monitor support. When recording in Insight mode, UFT records only on the primary monitor. Therefore, if you are working with dual monitors, make sure that your application is visible on the primary monitor during a recording sessionSteps recorded using low-level recording mode may not run correctly on all objects.
Insight recording requires more disk space than normal recording mode, because of the test object image and the snapshots stored with the test object.
To control the amount of space used, you can adjust the number of snapshots saved and their size in the Insight Pane (Options Dialog Box > GUI Testing Tab). These settings can also affect UFT performance when recording and running Insight steps.
Insight recording requires more space when compared to Low-level recording and depends on the scenario you are working on
Low-level recording requires more disk space than normal recording mode.
We may not be able to optimize the space used by low-level recording

Low-level recording requires less space when compared to Insight recording and depends on the scenario you are working on.
When created, all Insight test objects are named InsightObject, with an incremental suffix added if necessary, to avoid duplicate test object names within a single parent test object.
Does not apply - Usually only Window and Winobject test objects are only shown even after multiple webpage navigations and clicks
Only use Insight recording for mouse events. When possible, keyboard events should be recorded using standard or low-level recording.
Low-Level Recording can be used for capturing Mouse and keyboard activates on test object

Below images show the way OR captures the objects for Insight and Low-level Recording. I have used the same search operation on google search to obtain these snapshots





More Details on Insight Recording can be found here

Result


12/24/2015

UAT test results could be exported in the following formats:

UFT test results settings,you could see HTML, PDF and Doc are the 3 formats that are available to export test results.


Wednesday, December 23, 2015

Object Modesl - TOM, DOM, COM, AOM




Source: http://automated-360.com/qtp/advanced-concepts/all-about-object-models-in-qtp-uft/

All About Object Models in QTP / UFT


An Object Model is basically the way we use the object properties in a Programming language or technology. When we say usage of object properties, it means accessing the objects by object references to achieve the objectives like invoking a particular method of object. For example, object model of MS Excel, which enables other program to control it via different methods and properties.
A collection of objects or classes through which a program can examine and manipulate some specific parts of its world. In other words, the object-oriented interface to some service or system. Such an interface is said to be the object model of the represented service or system.

In this post we will discuss about the four different types of Object Models
  1. Test Object Model ( TOM )
  2. Document Object Model ( DOM )
  3. Component Object Model ( COM )
  4. Automation Object Model ( AOM )

Test Object Model ( TOM )
A collection of object types or classes which represents the different objects in the application. For Example a button object or edit box object in an application are the objects of and represent Button class or Edit box class. These test object class has a several properties to uniquely identify the objects of the particular class and methods to perform specific actions.
There are two types of objects in TOM,
  • Test Object and
  • Run-time object.
The objects which QuickTest creates and stores to represent the object in application, is a test object whereas a run-time object is the actual object in the application on which methods are performed during the run session, i.e the test object object properties are the properties as they are saved in the test object repository. Run time properties refers to the object properties as it appears in the application under test.
for example, a button with one of the properties “enable” is “true” in the object repository, which can be enable/disable at run time depending on certain conditions.
with this we can understand that the test object properties does not require your application to open and can be modified whereas a run-time object property requires the application to be open and it cannot be modified.
If you have ever wondered about the RO in GetROProperty and TO in SetTOProperty, now you know that RO is for Run-time Object and so GetROProperty is used to retrieve the value of the object at run time. TO is for Test Object and so the value of an object in object repository can be modified using SetTOProperty.

Document Object Model ( DOM )
Web Pages are organized into different objects like document, tables etc using the properties and methods available for the objects. These objects can be accessed by using scripts for the web pages. The Document Object Model is an interface(API) which allow programs and scripts to access and update the content, structure and style of documents. This is not only applicable for web pages (HTML) but for XML as well.
The objects in the document are in a hierarchy. DOM helps QTP to access this hierarchy of a web page directly by scripting. To access the DOM we use “.object” method for the specific web object.
For example, you can use DOM to identify an object when QTP is not able to identify an object. Consider the part of page source below for Google search page.

the part of the source is for the two buttons at Google search page.

GoogleSearch_buttons

If you need to click on the Google Search button using DOM, you will have to look into the source. For the button there are certain properties like id, name etc, you can find in the source above. These properties can be used to identify the object and do the action. If we take the Name property, this can be used by GetElementsbyName method as below

You can use GetElementsbyTagName to have all the button objects and then search for the required one as below

I am listing here some important properties and methods that you can use in QTP
GetElementById Method – returns a list of objects with specified id. If the id for the objects are not unique it take the first object with the specified value of the ID attribute.


ElementFromPoint Method – returns the object at specific coordinate on the page. for example the below code finds the search text box as per x and y coordinate and sets the value.


Some useful Properties which can be used for different purposes
activeElement – Retrieves the object that has the focus when the parent document has focus. Get the name of the text box which has the focus during runtime


cookie – Sets or retrieves the string value of a cookie. Find more details on Cookie here


documentElement - Retrieves the root node of the document.


readyState - Retrieves a value that indicates the current state of the object. This property can be used for sync in QTP scripts.


Component Object Model ( COM )
It is used to enable interprocess communication and dynamic object creation in a large range of programming languages. COM is the basis for several other Microsoft technologies and frameworks, including OLE, OLE Automation, ActiveX, COM+, DCOM, the Windows shell, DirectX, and Windows Runtime.
COM is basically used by developers to make the things simpler and easier to build and link by creating reusable components. The objects can be accessed by the interface (properties and methods) provided by COM for a particular class. Basically the properties and methods of an object can be the interface of the object and accessed by taking the reference of the object.
COM objects can be used with any tool that supports COM automation. And since VBScript supports COM automation, It becomes very easy to use in QTP scripting. But we cannot use all the COM objects, we can use only those objects that expose a string called a programmatic identifier (ProgID). Although not all COM objects have a ProgID, all COM objects have a 128-bit number called a class identifier, or CLSID. If a COM object has a ProgID, you can use VBScript to instantiate the object, invoke its methods and properties, and destroy the object.
To use a COM object in a script, you must first create an instance of the object. You can do this by calling the CreateObject or GetObject method.

CreateObject creates an Automation object of the specified class. If the application is already running, it creates a new instance. Set statement creates the reference between the object variable and the object. once the work is done the object reference should be destroyed as below

You can also use GetObject method which returns a reference to an instance of an object. It can be used in two way with its parameters, the object’s pathname and the object’s ProgID.

or


Automation Object Model ( AOM )
An Object Model is a structural representation of objects that comprise the implementation of a system or application. Automation enables software packages to expose their unique features to scripting tools and other applications. Usually Automation uses the Component Object Model (COM). A critical aspect of COM is, how client and servers interact. A COM server is any object that provides services to clients; these services are in the form of COM interface implementations like Properties, Methods, Events and their relationships. Which can be called by any client that is able to get a pointer to one of the interfaces on the server object.
QuickTest Professional is also a COM Server and its different methods and properties are exposed by its COM interface which can be accessed by other applications and scripting tools to control it from outside. In this post, we will see how to interact with QTP from outside via Automation Object Model.
Find more detail in the post Automation Object Model : QuickTest Professional by Anurag . It is same for UFT as well without any changes. Below code snippet illustrates the launch of UFT.

I hope you enjoyed reading about these object models and this will definitely help you in your automation. 

Tuesday, December 22, 2015

Training - Websites (cts), other sort of material

12/22/2015

Access onecognizant.cognizant.com, go to mylearning app and search for the following course codes. Trainings are really informative.

Course Code
Course Name
Duration
Delivery Mode
Start Date
End Date
(in Hrs)
BTLNA6
4.2
eLearning
26-Oct
27-Oct
CSEST045
2
eLearning
28-Oct
28-Oct
CSEST062
24
eLearning
28-Oct
4-Nov
CSEST179
4
eLearning
5-Nov
6-Nov
CSEST186
24
Classroom Training
(Location – Phoenix, AZ)
9-Nov
11-Nov
CSEST185
15
Classroom Training
(Location – Phoenix, AZ)
12-Nov
13-Nov
ATSTC4
NA
CCP-Assessment
16-Nov
20-Nov
ASEST077
QTP- Case Study Presentation
NA
Assessment
16-Nov
20-Nov