Monday 24 December 2012

PARAMETERIZATION IN QTP


PARAMETERIZATION IN QTP:

The process of replacing the fixed value with parameter is called parameterization.

The parameter value assigned from External resource or generator.

We use parameterization in data driven testing(Testing the same operation with multiple set of test data).


Type of parameterization

1) Datatable parameterization:

-> Its enable to create a data-driven test that runs several times using the data which one you supply.

-> In each repetation or iteration, Quick test use different values from datatable ( Either Global or Action).

-> Datatable contains two type of data sheets.

i) Global - This data sheet contains the data is available for all action.
ii)Action - This data sheet contains the data is available for only the perticular action according to the action number..

From keyword view

item         operation      value

q            set            "QTP"      <#>  

From above code from keyword view. we can use the <#> symbol for create parameterization.

Click the <#> Symbol in keyword view -> opened Value configuration option dialog box -> select parameter-> select "Data table" -> select name ( we can changes this name variable as per our wish) -> Select location in data table as Global sheet ( Global) or Current action sheet ( Action)  -> its create the variable name in datatable -> then give the value for variable in data table.


->Prior to data table parameterization focus on below 2 steps:

i) For Global Iteraion settings : The number of iteraion or repetitation is controlled from

File -> settings -> Run dualog -> we can see below three options

i)  Run one iteration only
ii) Run on all rows
iii)Run  from row X to row Y

Select any one of above option as per our needed.

ii) For Action Iteration Settings :

View -> Test Flow -> Right click on action node in test flow pane-> select Action call properties -> we can see below three options

i)  Run one iteration only
ii) Run on all rows
iii)Run  from row X to row Y


2) Test/Action Parameters ( Passing value from calling function(Script2) to called function (Script 1))

Step 1: Create called function/Action (Script 1)

-> We create one action for Gmail login, script looks like,

Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "arun"
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure "50d8459e3ef20b17b2d8d66d730b"
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click

-> saved script .

-> Right click on Action node and select Action properties. give the parameter name and data type in parameter tab. like

Name     type         Default Value       Description

Uname    String
Pswd     Password

-> Then you must use this input parameter in our script.

-> For use Uname Parameter Variable: from keyword view, select the cell which contains "arun" and click on  <#> symbol.-> Then value configuration dialog option open -> select parameter as Test/Action Parameters. and parameter name as Uname.

-> For use Pswd Parameter Variable : from keyword view, select the cell which contains "50d8459e3ef20b17b2d8d66d730b"(Password) and click on  <#> symbol.-> Then value configuration dialog option open -> select parameter as Test/Action Parameters. and parameter name as Pswd.

-> final script looks like

Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set Parameter("Uname")
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure Parameter("Pswd")
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click

-> save the script name as script1.
  
Step 2: Create called function/Action (Script 2)

-> Create new script name as script2

-> select insert -> call to Existion Action -> From select Action dialog box -> select from test as script1 as login -> Click ok.Now its added the statment to call login action of script 1 from script2.

-> Script looks like

RunAction "Action1 [parameter1]", oneIteration

-> Right click on node login and select Action call properties -> display Action call properties dialog -> select parameter values tab -> Enter value for Uname and Pswd like

Name     type         Default Value       Description

Uname    String        DemoUser  
Pswd     Password      *******

-> final script looks like
RunAction "Action1 [parameter1]", oneIteration, "DemoUser", "50d843bc6f4f3633"

-> Click ok and run the script

-> Now script2 calls Action login from script1 and passess username and password as DemoUser and *******


3)Random Number Parameterization

Enable you to insert random number in your test.

-> For use Random Number Parameterization : from keyword view, select the cell which contains "Gmail" and click on  <#> symbol.-> Then value configuration dialog option open -> select parameter as Random Number Parameterization.

-> Select the following option for configuring Random Number Parameterization

i)  Numeric Range - Enter the number range which random number generated.
ii) Name    - Assigns the vaiable name to your parameter.
iii)Generate New random number:

   For Each Action Iteration - Generate new number at end of each action iteration.
   For Each Test Iteration - Generate new number at end of each test iteration.
    once per entire test run - Generate a new number the first time the parameter is used. This same number used for parameter throughout the test run.


4) Environmental Variable parameterization

Its enable to use variable values from Environmental variables.Three types of method available in below,

i) Built in - its vaiable predefined in system like OS informtion and Action Name.

ii) User Defined Internal - The variable we can defined and use in the test. To create user defined inernal variable -> select File -> Settings -> Environment ->  User Defined -> Click add symbol -> add User defined variables

iii) User Defined External - we can use environmental varibles present in XML file.

To create user defined External variable -> select File -> Settings -> Environment ->  User Defined -> add the XML File.

In Xml file we should use below elements,

-> Type <Environment> elements in first line.like below section

<Environment>
<Variable>
<Name>Gmail_ID</Name>
<Value>QTP_USer</Value>
</Variable>
</Environment>

-> For use Environmental vaialbe Parameterization : from keyword view, select the cell which contains "Gmail" and click on  <#> symbol.-> Then value configuration dialog option open -> select parameter as Environmental vaialbe Parameterization -> Select name and value for parameter.

Saturday 22 December 2012

Check Points in QTP


Check Points in QTP.

Check point are verification points used to compare actual value with the expected value.

Actaul Value - Value that is present in application.
Expected Value - Value that is supposed to be in the application (While recording).

Its retrives  the value from object (Actual Result) and compare the value between Expected result ( specify the object property value while recording) and Actual result.

In QTP,there are total 8 types of check point.They are as follows:
1.(DCP)Database Check point:It checks the backend data of the application
2.(SCP)Standard check point:It checks the GUI objects properties
3.(TACP)Text area check point:It checks the perticular text area in a application
4.(TCP)Text check point:It checks the text in a application
5.(BCP)Bitmap check point: it checks the bitmaps in an application. It takes perticular area as a bitmap.But Image check point checks only web application
6.(XCPF)XML check point from file: It checks the XML code for the perticular file.
7.(XCP)XML check point:It can checks the XML web application
8.(ACP)Accessibility Check point: It can checks the accessibility of the web application only.


Type of Check points:

1) Standered Checkpoint:

-> Its compare the all prperty value of the object from Actual result with Expected result.

-> we can check the all property value.

-> If not match, Text case in fail.

In Recording Mode -> Place  curser in desired objects -> Insert -> Check Point -> Standered Check point -> Show the object -> Click ok -> select property and enter expected result -> Click ok -> Stop recording.

Browser("MyWebSearch").Page("MyWebSearch").WebEdit("searchfor").Check CheckPoint("searchfor")


2) Text Check point :

-> It Compare the object text property value from actual result with expected result.

-> We can use this type for the object which have the text property value.

-> we are not able use this check point type for the object which dont have the text prperty value.

In Recording Mode -> Place  curser in desired objects -> Insert -> Check Point -> Text check point -> Show the object -> Click ok -> select options (Match case,ignore Case, Exact case,text not diplayed)

Browser("MyWebSearch").Page("MyWebSearch").Check CheckPoint("MyWebSearch")

Note : When checking text, QuickTest tries to retrieve the text directly from the object. If QuickTest cannot retrieve the text in this manner (for example, because the text is part of a picture), it tries to retrieve the text using an OCR (optical character recognition) mechanism. The OCR mechanism translates images of handwritten or typewritten text into machine-editable text


3)Text Area Checkpoint:

->Check the text string displayed in windwos based application, according to the specified criteria

In Recording Mode -> Place  curser in desired objects (in windows based application) -> Insert -> Check Point -> TextArea check point -> Show the object -> Click ok -> select options (Match case,ignore Case, Exact case,text not diplayed)


4) Bitmap Check point:

-> while using bitmmap check point in recording mode, QTP capture the object and take one photo copy of the object and saved as a image file(Expected Result).

-> Bitmap check point compare the photo copy of the object(Expected result) with object present in application (Actual Result).

-> We can use all type of object for this type of check point( Becase its take bitmap for all object).

In Recording Mode -> Place  curser in desired objects -> Insert -> Check Point -> Bitmap check point -> Show the Bitmap -> Click ok -> Select "Check only Selected area" option if we want to compare part of the bitmap -> Click ok -> Stop recording


5) Database Check point :

-> its verify the content of the back end database.

-> We dont put the tool under the recording mode. Since data i from backend.

Insert -> Check point -> Database check point -> Chossse " Specify SQL statment manually"option -> click next -> click create -> select machine data source -> Select DSN(QT_FLIGHT32) -> Click ok -> enter SQL statement (Select * from orders) -> finishb -> click ok

For More information for use any database - > http://qtp.blogspot.in/2007/08/qtp-tutorials-6-database-checkpoint_05.html

6) Accessability checkpoint:

->Its checks that whether our webpage in our application developed according to the W3C rules and regulation or not.

-> This option is disabled always because its configurable checkpoint. So According to our requirements, we can customize.

Configuring in add ins:

Tools -> Options-> Web -> Advanced -> Select Quidelines to be checked according to the requirements.

In QTP:

In Recording Mode  -> Insert -> Check Point -> Accessbility Check point -> Click the page to be checked -> Click ok  -> Click ok -> Stop recording.


7) XML Checkpoint (From Resource)

-> Check the data content in the XML document in XML files.

In Recording Mode  -> Insert -> Check Point -> XML Check point(From Resource) -> Slect the XML file from local machine to check -> Select the check box against element

( we can check number of attributes, atributes values, number of child elements) -> Click ok  -> Click ok -> Stop recording.

8) XML Checkpoint (From Application)

-> Check the data content in the XML document opened in the web browser.

In Recording Mode  -> Insert -> Check Point -> XML Check point(From Application) -> Slect the XML document opened in web browser to check -> Select the check box

against element ( we can check number of attributes, atributes values, number of child elements) -> Click ok  -> Click ok -> Stop recording.


9) Page Check point( Using Standered check point)

-> Its check the number of links, images and loading time in web page.

-> It is a hiden check point, we can isnert this through standered check point.

In Recording Mode -> Place  curser in desired objects -> Insert -> Check Point -> Standered Check point -> Show the object selection - Checkpoint property -> Select

the page item from the displayed object tree  -> Click ok -> select and verify the loading time, number of links and number of images-> click ok-> Stop recording.


10) Image Check point (Using Standared Check point):

-> Its check the imapge property values.

-> It is a hiden check point, we can isnert this through standered check point.

In Recording Mode -> Place  curser in desired objects -> Insert -> Check Point -> Standered Check point -> Show the Image -> Click ok  -> Click ok -> Stop recording.


11) Table Check point(Using Standered Check point):

-> Its check contents of web tables.

-> It is a hiden check point, we can isnert this through standered check point.

In Recording Mode -> Place  curser in desired objects -> Insert -> Check Point -> Standered Check point -> Show the web table -> Click ok  -> Click ok -> Stop recording.


Store Check point return value into variable:

QTP return the value always. Its depends on whether we capture or not.

steps:

Declare the variable and catch the return value into the variable

Dim return
return = Browser("MyWebSearch").Page("MyWebSearch").Check CheckPoint("MyWebSearch")
msgbox(return)

But this is not correct format.

we want to enclose the bracket in check point function like -> Check (CheckPoint("MyWebSearch"))

So final statments like

Dim return
return = Browser("MyWebSearch").Page("MyWebSearch").Check ( CheckPoint("MyWebSearch"))
msgbox(return)

Reference Links:

http://qtp.blogspot.in/2007/08/qtp-tutorials-11-checkpoint-return.html
http://www.gcreddy.com/2010/04/inserting-checkpoints.html

Monday 17 December 2012

Synchronization in QTP


Synchronization :

Synchronization refers to adding a step in the script that instructs Quick Test to wait for a particular object before proceeding to the next step during playback

1) Wait  ( Sytntax : Wait(n))  

-> QTP wait 'n' number of millisec for proceeding next step.\

2) Exist ( Syntax : Object.Exist )

-> Its verify the perticular object exist in application or not.
-> Return the boolean value (True or False)

3)  Sync : ( Syntax : Browser. Sync)

-> This key word used for only in Browser.
-> QTP instructs to wait still Browser launch get completed.

4) Step for insert Synchronization Point in QTP :

-> Run the Record session.( QTP should Recording mode )
-> Click Insert -> Synchronizatio n point.
-> select object which you want to insert synchronization point.
-> Show object
-> click "OK"
-> Select "PROPERT NAME" and "PROPERTY VALUE"
-> Enter Milli Second
-> Click "OK"
-> Stop Recording mode.


5) Browser Navigation Time out :

-> QTP wait for specific time for web page load get completed
-> File -> Settings -> Web -> Browser Navigator

6) object Navigation Time out :

-> QTP wait for specific time still object load get completd.
-> File -> Settings -> Run -> object Synchronization time out.

Saturday 8 December 2012

QTP DOES NOT RECORD THE WEB OBJECTS IN VISTA AND WINDOWS 7 WITH IE8




1) QTP doesnot support the windows 7 and IE8. QTP OR is not capture all objects in the web application. because its not support Window 7 platform and IE8 application.

Solution:

The solution to the problem was turning the setting “Enable Protected Mode” off in Internet Explorer.  To do this perform the following steps:
Mode” off in Internet Explorer.

To do this perform the following steps:

1.Open Internet Explorer
2.Select “Tools > Internet Options”
3.Click the Security tab
4.Make sure “Enable Protected Mode” is unchecked so that it is off(as shown below).
5.And at last don’t forget to restart your IE. Thats it !!


For More Inforamtion refer this link ->http://www.anitpatel.net/2012/07/02/qtp-does-not-record-the-web-objects-in-vista-and-windows-7-with-ie8/