Friday, 7 October 2016

Descriptive Programming

Descriptive Programming:- Descriptive Programming is directly passing the properties and values directly into script without using Object Repository. There are two types
1.     Static (by provide the set of properties and values directly) 

In Static Descriptive programming, we can pass the description of the object directly in script as show bleow.
Syntax:-Browser(Propertyname:=Propertyvalue).Page(propertyname:=propertyvalue).webbutton(propertyname:=propertyvalue)

2.      Dynamic (by creating description object) 

Set Desc = Description.Create() is a dynamic way.

Description Object stores the properties and values of a particular object in an instance of that object. 
For example, consider there are 3 objects Browser, Page and a Button.To develop DP, first we need to create empty description objects as shown below: 

Set ObjBrowser = Description.Create 
Set ObjPage = Description.Create 
Set ObjButton = Description.Create 

Next we need to add identification properties & values to these objects as 

ObjBrowser("name").value = "BrowserName" 
ObjPage("title").value = "PageName" 
ObjButton("name").value = "ButtonName" 

Thursday, 6 October 2016



What is Evnironment Variables?

Environment variables are global variables.  The scope the variable are thru out the executions.  Means we can access the environment variables anywhere in the script that we want.

There are 2 types Environment Variable.

1.Built-in Environment Variables:-provides information about Actionname, Test-Directory, OS Version,OS Name etc.....


Path to Environment variables:-File--->Settings--->Environment


2.User Defined Environment Variables has sub-types

a. Internal
b. External

a. Internal

User Defined-Internal Environment Variables:- These variables are user defined variables in the test before executing the test we need to spcify. these variables are accessed thru out the test.


Path to User Defined-Internal:-File--->Settings--->Environment Tab


Note:- "+" button is used to Enter Name and Value.

b. External

User Defined-External Variables:-These variables are defined by the user and it can be used globally across different tests


Path to User Defined External :- File--->Settings--->Environment Tab

Click on Export Button to upload .XML file.







Wednesday, 5 October 2016

WebTable in UFT/QTP

WebTable in UFT/QTP.

In HTML, Tables are plays a vital role to align the objects in proper order.


In UFT/QTP We have WebTable Methods to handle them.


 Every web table contains data (text data) and child objects in specified cells. When we are working with descriptive programming using UFT/QTP, web table object is very useful to get data or to get object information for further activities.






Below is the sample code snippet.


syntax:-


set Obj_WebTable=Browser(.browername).Page(pagename).WebTable(Tableobject)


To get RowCount from WebTable


syntax:- Rcount=Obj_WebTable.
RowCount

To get columncount from WebTable


syntax:- Ccount=Obj_WebTable.
ColumnCount(row)

To Get Text from the cell in WebTable


syntax:- str_text=Obj_WebTable.
GetCellText(Row,column)R

To Get row number with celltext in WebTable


syntax:- r=Obj_WebTable.
GetRowwithcelltext(string)

To Access total child object from Web Table


syntax:-Obj_WebTable.
ChildObjects(Description)

 to access child objects from a web table cell in web table object without using description object.a


Syntax:- Obj_WebTable.
ChildItem (RowColumnMicClassIndex)

To get Child item count from the web table.


Syntax:- Obj_WebTable.
ChildItemcount(Row,Column,MicClass)

Eval

Eval

Evaluates the Expression and returns the result

Syntax:- Eval(string)

In VB-Script, x = y can be interpreted two ways. The first is as an assignment statement, where the value of y is assigned to x. The second interpretation is as an expression that tests if x and y have the same value. If they do, the result is True; if they are not, the result is False. The Eval method always uses the second interpretation, whereas the Execute statement always uses the first.





Dictionary Object

What is Dictionary Objects?

Dictionary object is the equivalent to associative array. Items can be any form of data, and are stored in the array. Each item is associated with a unique key. The key is used to retrieve an individual item and is usually an integer or a string, but can be anything except an array.

sample snippet:-

Dim dict   ' Create a variable.
Set dict = CreateObject("Scripting.Dictionary")
dict.Add "country", "India"   ' Add some keys and items.
dict.Add "Tool", "QTP"
dict.Add "Product", "HP"

It has fallowing Methods:-


1.Add
2.Items
3.Keys
4.Remove
5.RemoveAll
6.Exists

It has fallowing properties:-

1.Item
2.Add


Automation

What is Automation Testing?

In software testingtest automation is the use of special software (separate from the software being tested) to control the execution of tests and the comparison of actual outcomes with predicted outcomes. Test automation can automate some repetitive but necessary tasks in a formalised testing process already in place, or perform additional testing that would be difficult to do manually. Test automation is critical for continuous delivery and continuous testing.

The following tools can be used for automation testing
HP Quick Test Professional
Selenium.
IBM Rational Functional Tester.
SilkTest.
TestComplete.
Testing Anywhere.
WinRunner.

LoadRunner.