Sunday, 6 September 2015

REAL TIME VERY IMP POINTS IN QTP




QTP 9.0,9.1,9.2
 
QTP 9.0:
ü  Test menu item is renamed as Automation
ü  Settings option is moved from test menu item to file menu item
ü  Quality center connection option is moved from tools menu item to file menu item
ü  Step menu item is removed and all the options present under it are kept in the edit menu item
ü  A new menu item window is introduced used for managing the window
ü  A new option by name function definition generator is introduced which is used for creating the functions easily
ü  New options are provided for commenting and un commenting the block of statements
ü  A new option by name check syntax is introduced under tools menu item used for checking the syntax of script
ü  Some of the options related to the resources like object repository, recovery scenario manager are moved from tools menu item to a new menu item resources
ü  A new menu item resourced is introduced with some new options like object repository manager and associate repositories
ü  Object repository manager is used for creating and managing the shared repositories with out having any connection to the test


Anatomy of QTP 9.0:

                        QTP 9.0 screen can be divided in to 7 parts
1.    Test pane
2.    Active screen
3.    Data table
4.    Debug viewer pane
5.    Tool Options
6.    Information screen
7.    Missing resources screen

6.Information screen:
Information pane is used for viewing the syntax related information during the syntax
            Check
Main change: One can associate one or more shared repositories to an action a part from its local repository

7.Missing resources:
When the test is being open if at all any associate resources like repositories, library files, recovery files are missing then the complete information related to that will be shown in the missing resource pane

QTP 9.1:
ü  A new feature by name navigate and learn is introduced present in multiple pages or windows continuously by navigating
ü  A new feature by name object repository comparison tool is introduced which is used for comparing two shared repositories
ü  QTP 9.1 is compatible with windows vista operating system and .net frame 2.0 environment
ü  The script editor is made user friendly
ü  The company has announced that they will provide license for all the add ins also

                        QTP 9.2:
ü  A new feature by name screen recorder is provided which is used for recording the movie of the execution and that can be played back during the result analysis for better understanding
ü  One can handle the object repositories dynamically through scripting with the help of an utility object repositories collection
Example:

                           Repath= “d:\r1.tsr
                           Repositories collection.remove all( )
                           Repositories collection.add(repath)
                                    vbwindow("Form1").VbEdit ("val1").set “10”
vbwindow("Form1").VbEdit("val2").Set “20”
vbwindow("Form1").VbButton("ADD").Click

Pos= repositories collection.find(repath)
Repositories collection.remove(pos)


ü  Object spy functionality is enhanced in such a weather one can view multiple objects information continuously by keeping the mouse pointer over the object
ü  QTP 9.2 is compatible with the following browser
Ø  Internet explorer 7.0
Ø  Mozilla fire fox2.0
Ø  Net space navigation 8.1.0





QTP 10 and 11

In QTP 10, the test results can be exported in formats such as PDF, Doc, and HTML whereas this is not possible in QTP 9.5.

All resources can be saved at one place only in version 10.

While monitoring, the type of variable can also be viewed in QTP 10.

Installation file is a single one bundled with all add-ins, previously we have to download add-ins separately.

Movie recorder was introduced in the results
 Web add-in extensibility add- in was introduced
 Maintenance run mode was introduced
It also supports the 64 bit windows edition while the earlier were supporting only 32 bit systems only


What are the disadvantages in using of checkpoints?

o They are QTP internal files we can’t use in external functions
o As they are QTP internal files they may corrupt
o As it is ready made feature, that has limited usage
 What test cases can be automated?

Test cases that we want to execute on number of versions of the software
Ex: Regression test cases
Test cases that we want to execute with multiple sets of data
Ex: Data driven test cases
Test cases having complex functionality
What test cases cannot be automated?

o Dynamically changing functionality
o Test cases that require more Human interaction
o CUI (command user interface) based test cases

What types of License available for QTP?

a) Seat License or Node locked:
Fixed for one System (Machine), we can use from that System only
b) Concurrent License or Floating License:
This License, we can use from different Systems but one at a time
What are the major disadvantages in record tests?

Recording disadvantages:
o It occupies a lot of memory space due to this, QTP performance will be reduced
o Modifications are very difficult
o User may not have command on the script, if any modifications are there user may not understand properly
o Recorded scripts are QTP internal files, they may corrupt.

What are the disadvantages in using of checkpoints?

o They are QTP internal files we can’t use in external functions
o As they are QTP internal files they may corrupt
o As it is ready made feature, that has limited usage
)What are the differences between Actions and Functions and which are better?

Actions:
o It’s a QTP feature and Local feature (not a global feature)
o We can use check points in Actions
o As it is QTP feature it may corrupt
o Actions are slow execution

Functions:
o It’s a VB script feature and global concept
o We can’t use checkpoints in functions, instead of checkpoints we can use validation points (Loops and Conditional statements)
o It doesn’t corrupt
o Functions are faster in execution than Actions

 What are the extensions of QTP files?

o QTP Test / Test Script(.mts){.mts=module/mercury test script}
o Local Repository file (.mtr){.mtr=module/mercury test repository}
o Shared repository files(.tsr){Test shared repository}
o Library files (.vbs)
o Environmental files (.xml)
o Test batch file (.mtb){module test batch}
o QTP result file (xml) optional: pdf, doc, xml-for reporting
o Recovery scenario file (.qrs){quick recovery scenario}

 Descriptive Programming Advantages:
a) Descriptive Programming based Test scripts are faster in execution than Repository based Test scripts.

b) Scripts are portable (we can run these scripts from any machine easily)

c) Maintenance is easy (less amount of resources)

d) We can start Test Execution process even though Application is not ready.


1) Count, how many Buttons and Edit boxes available in Flight Reservation main window.


SystemUtil.Run PATH OF THE APPLICATION
     Dialog("Login").Activate

   Dialog("Login").WinEdit("Agent Name:").Set "akhilreddy"

     Dialog("Login").WinEdit("Password:").Set "mercury"

    Dialog("Login").WinButton("OK").Click



   Set Desc = Description.Create()

    Desc("micclass").Value = "WinButton"

 Set Buttons = Window("text:=Flight Reservation").ChildObjects (Desc)

 Num_Buttons = Buttons.Count()

Set Desc1=Description.Create()

 Desc1("micclass").Value="WinEdit"

 Set Editboxes=Window("text:=Flight Reservation").ChildObjects (Desc1)

 Num_Editboxes= editboxes.count ()

sum= Num_Buttons+Num_Editboxes

 Reporter.ReportEvent 2, "Res","Total Buttons: "& Num_Buttons &"Total Edit boxes: "& Num_Editboxes

2) Count all opened Browsers on desktop and close all?

Set Desc = Description.Create()

    Desc("micclass").Value = "Browser"
     Set Browsers =Desktop.ChildObjects (Desc)

    NumberofBrowsers = Browsers.Count()

    Reporter.ReportEvent 2,"Res","Number of Browsers are: "&NumberOfBrowsers

    For Counter=0 to NumberofBrowsers-1

     Browsers(Counter).Close

     Next

3) Create an Excel file, enter some data and save the file through VB scripting?

Dim objexcel

    Set objExcel = createobject("Excel.application")

    objexcel.Visible = True

     objexcel.Workbooks.add

     objexcel.Cells(1, 1).Value = "akhil is a good boy"

     objexcel.ActiveWorkbook.SaveAs("f:\exceltest.xls")

     objexcel.Quit

4) Get Test Data from a Flat file and use in Data Driven Testing (through Scripting)
Dim fso,myfile
      Set fso=createobject("scripting.filesystemobject")
    Set myfile= fso.opentextfile ("f:\anyxl file.xls",1)
      myfile.skipline
      While myfile.atendofline <> True
      x=myfile.readline
      s=split (x, ",")
      SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
  Dialog("text:=Login").Activate
Dialog("text:=login","width:=320").winedit("attached text:= Agent Name:").set"akhil"
Dialog("text:=login").winedit("attachedtext:=password:").setsecure"mercury"
Dialog ("text:=login").winbutton("text:=ok").click
Window("Flight Reservation").Close
wend

Checking whether the File is available or not, if not creating the File


strDirectory="E:\"
strFile="aaa.xls"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strDirectory & strFile) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFile = objFSO.CreateTextFile("E:\aaa1.xls")
End if

7) Creating a Flat File
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.CreateTextFile("E:\akhil.txt")


DELETE A FLAT FILE


Set objFSO=createobject("Scripting.filesystemobject")
Set txtFilepath = objFSO.GetFile("E:\AKHIL.txt")
txtFilepath.Delete()


vb script

 

  • VBScript is a scripting language.
  • A scripting language is a lightweight programming language.
  • VBScript is a light version of Microsoft's programming language Visual Basic.


2.0 Comments
The comment argument is the text of any comment we want to include.
2.0 Purpose of comments:
o   We can use comments for making the script understandable.
o   We can use comments for making one or more statements disable from execution.
2.1 Syntax

Rem comment (After the Rem keyword, a space is required before comment.)
Or
            Apostrophe (') symbol before the comment

2.2 Comment/Uncomment a block of statements

  • Select block of statement and use short cut key Ctrl + M (for comment)
  • Select comment block and use short cut key Ctrl + Shift + M (for uncomment)
                                                                                                                             
VARIABLE: It is a name given to a memory location, which can hold a value and that can be changed any number of times in future if required.
Adv:  Reusability & easy to maintain (future updations are easy) .
 NOTE: always use meaningful names.
Syntax: Datatype variablename;

CONSTANT: It is a name given to a memory location, which can hold a value that can’t be changed in future.
Syntax:  final Datatype constantname=value;             if…. else

CONDITIONAL STATEMENTS :( decision making statements)
In java we have two types of conditional statements.
If …else
Switch… case
IF--- ELSE: whenever we want to execute one block of statements
 among two blocks then we can use If..Else.
 Syntax: if(condition) {     block of stmts1       } else { block of stmts2 }
Note : condition is true then block of stmts1 will be executed
Switch…case: Whenever we want to execute a particular block of statements among many blocks then we will choose switch case statement.
 Syntax: switch(choice) {
case “c1”:
 block1
                        break;          
case “c2”:
                        block 2
                        break;
            -----------
            Default: ------ // not mandatory
}
LOOPING STATEMENTS: Looping statements are used for executing a certain block of statements repeatedly and continuously for some number of times.
in java we have 3 types of looping statements
for loop
while loop
do…while loop
for loop: whenever we clearly know how many no of times the block should be repeated then use for loop.
syntax : for(initiation ;condition ;improvement)
            { 
---------------- block of stmts
 }
While loop: It is used for executing a block of statements repeatedly as long as the condition is being satisfied.
Syntax: while( condition) 
            { ------- block of stmts
            }
do---- while loop: It is used for executing a block of statements repeatedly as long as the condition is being satisfied, but first time execution will be done without checking the condition.
Syntax:  do {
 -------------block of stmts
}  while(condition) ;
ARRAYS:  Array is a special type of variable which can hold multiple values.
in java we have the following types of arrays
single Dimensional array
multi Dimensional array
object array


5 comments:

  1. Thanks for this real time important concept posting... After this i became the fan of you....
    websphere Online Training

    ReplyDelete
  2. I used to be able to find good info from your content.
    Laptop service centers in Hyderabad

    ReplyDelete
  3. Hi you are providing good information.Thanks for sharing good content.If anyone looking for good institute for
    hardware and networking training in hyderabad reach us .

    ReplyDelete