Вы находитесь на странице: 1из 39

HP - QuickTest Professional

31 August 2011

Agenda (Day 1)
      

Automated Tests vs Manual Tests Introduction to Test Automation Introduction to QTP Record / Playback The First Step Types of Recording What is Synchronization Checkpoints

31 August 2011

Automated Tests vs Manual Tests

31 August 2011

ADVANTAGES
Automated Testing 1. If you have to run a set of tests repeatedly automation is a huge gain. 2. Helps performing "compatibility testing" testing the software on different configurations. 3. It gives you the ability to run automation scenarios to perform regressions in a shorter time. 4. It gives you the ability to run regressions on a code that is continuously changing. 5. Can be run simultaneously on different machines thus decreasing testing time. 6. Long term costs are reduced. Manual Testing 1. If Test Cases have to be run a small number of times it's more likely to perform manual testing. 2. It allows the tester to perform more ad-hoc (random testing). 3. Short term costs are reduced. 4. The more time tester spends testing a module the greater the odds to find real user bugs.

31 August 2011

DISADVANTAGES
Automated Testing 1. It's more expensive to automate. Initial investments are bigger than manual testing. 2. Can t automate visual references, some tests still have to be done manually. Manual Testing 1. Manual tests can be very time consuming. 2. For every release you must rerun the same set of tests which can be mundane and tiresome.

31 August 2011

Introduction to Test Automation

31 August 2011

Need of Automation
Speed Automation Scripts run very fast when compared to human users (NOT ALWAYS) We can run automation scripts simultaneously on different machines without manual intervention. Reliable Tests perform precisely the same operations each time they are run, there by eliminating human error. Repeatable We can test how the application reacts after repeated execution of the same operation. We can rerun test cases for different set of test data. We can rerun test cases on different environment conditions. Comprehensive We can build a suite of tests that covers every feature in our application Reusable We can reuse tests on different versions of an application, even if the user interface changes.

31 August 2011

Rule of Thumb When to Automate and when not to?


Is it possible to automate? Is it necessary to rerun this test again and again? Is ROI worth automating? Test automation success depends on robustness of the test cases not on the test tool. If it is not worth, DO NOT AUTOMATE.

Use Common Sense

31 August 2011

What are the different tools available in the market- For Functional Test Automation
QuickTest Professional (HP) WinRunner (HP) Robot (IBM Rational) Functional Tester (IBM Rational) SilkTest (Borland) TestComplete (AutomatedQA) QAWizard (Seapine) TestPartner (Compuware) QEngine (AdventNet) Ranorex (EOSS Group) Open source tools (Sahi, Selenium, Watir)

Latest version of HP QuickTest Professional is 11.0 (called as HP Functional Testing )

31 August 2011

Criteria for selecting test automation tool


1. Application to be tested 2. Test environment 3. Scope and limitation of the tool 4. Feature of the tool 5. Cost of the tool. Ease of use (Team expertise) 6. Ease of Installation 7. Multiple OS Support (As per project needs) 8. Multiple Language Support (As per project needs) 9. Integration with 3rd party tools (defect management tools or other tools) 10. Report Generation 11. Desktop/Web products testing 12. Support for Data Driven testing (data stored in text / xml / excel file)

31 August 2011

10

Life Cycle Of Test Automation


Analyze the Application

Select the Tool

Identify the Scripts (Feasibility Study)

Design/ Record/Write/Enhance Test Scripts

Run the Test Scripts

Analyze the Test Results & Reporting the Defects

31 August 2011

11

Introduction to QTP

31 August 2011

12

Introduction to QTP
Developed by Mercury Interactive now owned by HP QTP supports both web applications & windows applications Test Script developed on VB Script QTP supported Technology .NET. J2EE, Main Frame, XML, Java, Delphi, SAP, Seibel, People soft, Silverlight, Flex, Ajax, GWT, Dojo etc QTP run on only windows platform not supporting UNIX, Linux etc QTP supported multimedia RealAudio/RealVideo, Windows Media Player, Flash

31 August 2011

13

Environment needs for QTP 11.0


System Requirement Hardware Drive RAM OS : Equivalent to Pentium IV or above : 1GB of Free Disk space : 1GB of RAM : MS Windows 2003 Server with Service Pack 2 MS Windows XP with Service Pack 2 or 3 MS Windows Vista with Service Pack 2 MS Windows 2008 Server MS Windows 7 : MS Internet Explorer 6.0 and above Netscape Navigator 6.11, 6.22, 6.23, 7.02, 7.1 AOL 8.0, 9.0

Web Browser

31 August 2011

14

Add-ins of QTP
Technology supported by the QTP By default three Add-ins are there in QTP ActiveX VB Web Additional Add-ins: Java Oracle People soft .NET Terminal Emulator (RTE) SAP Siebel Delphi

31 August 2011

15

Window Structure of QTP


1. 2. 3. 4. 5. 6. Test Pane Active Screen Data Table Debug Viewer Information Missing Resources

31 August 2011

16

QTP 11.0 Features


XPath and CSS based object identification Enhanced Results Viewer Easy Regular Expressions Identify objects in relation to neighboring objects using Visual Relation Identifier Load Function Libraries at Run Time by LoadFunctionLibrary statement Recording on Firefox Browser is now available Capable of receiving Java or .NET log framework messages from your application which can then be embedded in the run results Can instruct QTP to automatically parameterize test steps at the end of record session Support WPF and Silverlight Application

31 August 2011

17

Record / Playback The First Step

31 August 2011

18

QuickTest Testing Process


Preparing to record Recording

Reporting defects

Enhancing your test

Analyzing the test results

Debugging your test

Running your test

31 August 2011

19

Let s Record
1. 2. 3. 4. 5. 6. 7. 8. Open "http://newtours.demoaut.com/" website Click Record to start recording Login user name/password (default as mercury/mercury) Fill the "Flight finder" form Click "continue Select flight Click "continue Book the flight Run the test twice. Do you face some problem? Why? Start / End condition Note - View QTP generated file in Windows Explorer

31 August 2011

20

Analyzing Keyword View


As you recorded your test, QuickTest generated steps in the Keyword View representing each operation you performed. The columns in the Keyword View show different information for each step, as follows: Item. The item for the step (test object, utility object, function call, or statement) in a hierarchical icon-based tree. Operation. The operation to be performed on the item, for example, Click or Select. Value. The argument values for the selected operation, for example, the mouse button to use when clicking the image. Documentation. Auto-documentation of what the step does, in an easy-tounderstand sentence, for example, Click the "findFlights" image. Assignment. The assignment of a value to or from a variable so you can use the value later in the test. This column is not visible by default. Comment. Any textual information you want to add regarding the step, for example, Return to page used in first step of the test. This column is not visible by default.

31 August 2011

21

Types of Recording

31 August 2011

22

Recording Modes in QTP


Normal Recording Mode 1. Default mode of recording in QTP 2. Records Objects in application Actions performed on them 3. Object recognition is independent of location of the object on the screen 4. Uses QuickTest test object model Analog Recording Mode 1. Records Exact mouse and keyboard movement in relation to screen or the application window 2. Cannot edit analog recording steps 3. Useful for steps which cannot be recorded at object level. e.g. Signature 4. Records every movement of mouse Low Level Recording Mode 1. Records Objects as Window test objects 2. Useful for objects not recognized by QTP 3. Useful for objects where exact co-ordinates are required

31 August 2011

23

Guidelines for Analog and Low Level Recording

Can switch recording modes in the middle of the recording sessions. Analog Require more disk space than normal recording mode. Use only when normal recording mode does not accurately record your operation.

Low Level

31 August 2011

24

Guidelines for Analog Recording


Relative to the window If the operations you perform are on objects located within one window and that window does not move during the analog recording session. QuickTest does not record any click or mouse movement performed outside the specified window. When using this mode, QuickTest does not capture any Active Screen images.

Relative to the screen

If the operations you perform are on objects located within more than one window. QuickTest captures only the Active Screen image of the final state of the window on which we are recording. The steps recorded using analog recording are saved in a separate data file. This file is stored with the action in which the analog steps are recorded. QuickTest adds to our test, a RunAnalog statement that calls the recorded analog file.

31 August 2011

25

Analog Recording
Open Programs > Accessories >Paint application. In Paint: Go to Image > Attributes and set the width and height to 900 pixels and click OK. In QuickTest: click the Record button to begin a recording session. Click the Analog Recording button or choose Automation > Analog Recording. The Analog Recording Settings dialog box opens

Click Analog Recording button

31 August 2011

26

Analog Recording Cont


The Analog Recording Settings dialog box opens There are 2 options available: Record relative to the screen Record relative to the following window Select Record relative to the following window Click the pointing hand and click anywhere in the Paint window on which you want to record in Analog Recording mode. The title of the window you clicked is displayed in the window title box.

31 August 2011

27

Analog Recording Cont


Click Start Analog Record. Perform the operations you want to record in Analog Recording mode. When you are finished and want to return to normal recording mode, click the Analog Recording button or choose Automation > Analog Recording to turn off the option. You should see the following statement in your script: Window("Paint").RunAnalog "Track1

Note: Practice analog recording in Record relative to a specified window and Record relative to the screen modes.

31 August 2011

28

Create a Script for Paint Application


In Paint: 1. Select File > New. 2. Click on Pencil tool in the Tool Box. 3. Click on color Red in the Color Box. 4. Write the following text: QTP rules!!! 5. Select File > New. 6. In dialog box Paint click No to discard changes. In QuickTest: Use Standard Mode for steps 1-3 inclusively. Use Analog Mode for step 4. Use Standard Mode for steps 5-6 inclusively. Note: Create the script using the Record relative to a specified window mode.

31 August 2011

29

Low Level Recording Guidelines


Use low-level recording for recording on environments or objects not supported by QuickTest. Use low-level recording for when you need to record the exact location of the operation on your application screen. While recording in normal mode, QuickTest performs the step on an object even if it has moved to a new location on the screen. If the location of the object is important to your test, switch to Low Level Recording to enable QuickTest to record the object in terms of its xand y- coordinates on the screen. This way, the step will pass only if the object is in the correct position. While low-level recording, QuickTest records all parent level objects as Window test objects and all other objects as WinObject test objects. They are displayed in the Active Screen as standard Windows objects. Low-level recording supports the following methods for each test object: Window test objects: Click, DblClick, Drag, Drop, Type, Activate, Minimize, Restore, Maximize Each step recorded in Low Level Recording mode is shown in the Keyword View and Expert View. (Analog recording records only the one step that calls the external analog data file.)

31 August 2011

30

Low Level Recording


You can switch to Low Level Recording mode only while recording a test. The option is not available while editing a test. To record in Low Level Recording mode: 1. Click the Record button to begin a recording session. 2. Click the Low Level Recording button or choose Automation > Low Level Recording. The record mode changes to Low Level Recording and all of your keyboard input and mouse clicks are recorded based on mouse coordinates. When QuickTest runs the test, the cursor retraces the recorded clicks. 3. When you are finished and want to return to normal recording mode, click the Low Level Recording button or choose Automation > Low Level Recording to turn off the option. Class work: Record Exercise 1 in Low Level Recording mode. Use the mix of different modes to make the script work.

31 August 2011

31

Low Level Recording Cont


The examples below illustrate the difference between the same operations recorded using Normal Recording Mode and Low Level Recording mode. In the Normal Recording Mode your test is displayed as follows in the Keyword View and Expert View:

Window("Notepad").WinEditor("Edit").Type "This is a sample test If you perform the same action while in Low Level Recording Mode, QuickTest records the click in the Edit box, followed by the keyboard input. Your test is displayed as follows in the Keyword View and Expert View:

Window("Notepad").WinObject("Edit").Click 17,27 Window("Notepad").WinObject("Edit").Type "This is a sample test"

31 August 2011

32

Synchronization in QTP

31 August 2011

33

What is Synchronization
Inserts a synchronization point in the test, instructing QuickTest to pause the test until the object property value is achieved (or times out). There are several options that you can use to synchronize your test: You can insert a synchronization point by choosing Insert > Synchronization Point, and QuickTest generates a WaitProperty statement in the Expert View. You can insert Exist or Wait statements that instruct QuickTest to wait until an object exists or to wait a specified amount of time before continuing the test. You can modify the default amount of time that QuickTest waits for a Web page to load by changing Browser Navigation Timeout in the File > Settings > Web tab. When working with tests, you can increase the default timeout settings for a test to instruct QuickTest to allow more time for objects to appear by changing the Object Synchronization Timeout in the File > Settings > Run tab.

31 August 2011

34

Checkpoints in QTP

31 August 2011

35

Types of Checkpoints
A checkpoint verifies that expected information is displayed in your application while the test is running. Types of various checkpoints: 1. Standard Check Point : Checks the property value of an object in your application or Web page. Standard checkpoints are supported for all add-in environments. 2. Bitmap Check Point : Checks an area of your Web page or application as a bitmap. For example, suppose you have a Web site that can display a map of a city the user specifies. Bitmap checkpoints are supported for all add-in environments 3. Database Check Point : Checks the contents of a database accessed by your application. Database checkpoints are supported by all environments 4. Text Check Point : Checks that a text string is displayed in the appropriate place on a Web page or application. Text checkpoints are supported for the Web environment, plus some Web-based add-in environments. 5. Text Area Check Point : Checks only the text string captured from the defined area is displayed (Text Before and Text After are not displayed).

31 August 2011

36

Types of Checkpoints Cont...


6. Accessibility Check Point : Identifies areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. Accessibility checkpoints are supported for the Web environment 7. XML Check Point - Web page : Checks the data content of XML documents in Web pages and frames. The XML Checkpoint (Web Page/Frame) option is supported for the Web environment. 8. XML Check Point - File : Checks the data content of XML documents in XML files. The XML Checkpoint option is supported for all environments

31 August 2011

37

Standard Checkpoints
Standard Checkpoints checks the property value of an object in your application or Web page. The standard checkpoint checks a variety of objects such as buttons, radio buttons, combo boxes, lists, and so forth. Using Standard Checkpoints, we can create following checkpoints:
 Image checkpoint : checks the value of an image in your application or Web page. Image checkpoints are supported for the Web environment  Table checkpoint: checks information within a table. For example, suppose your application or Web site contains a table listing all available flights from New York to San Francisco. You can add a table checkpoint to check that the time of the first flight in the table is correct.  Page checkpoint: checks the characteristics of a Web page. For example, you can check how long a Web page takes to load or whether a Web page contains broken links. Page checkpoints are supported for the Web environment

31 August 2011

38

Thank you.

31 August 2011

Вам также может понравиться