Está en la página 1de 30

QuickTest Professional

Class 1

•Introduction to Test Automation


•Record/Playback
Class Duration

 40 hours of instructor led sessions


 Homework assignments (60+ hours)
 School Lab open during the week
 10 sessions, 4 hours each
 Break – 9:00 to 9:15
Class Rules
 Homework must be done prior to class
 Questions are encouraged but may be
answered after the class or during the break
time
 No talking, browsing the internet or online
chatting during the class
 Cell phones must be on mute during the
class, if you need to take a call take it
outside
 No one will be left behind
Tell Us About Yourself?
 Name?
 Education?
 Software experience or any
programming experience (Ex. C, Visual
Basic)?
 Why QA?
 What do you want to gain in this class?
 Career goals?
Types of Interfaces
 GUI
 Graphical User Interface (GUI) is a method of interacting with a
computer by using graphical icons which are often used in
conjunction with text, labels or text navigation to fully
represent the information and actions available to a user.
 API
 Application Programming Interfaces (APIs) allow code-level
access to the functionality. Programmable interfaces tend to
exhibit less volatility than GUI after the original design has
been worked through.
 CLI
 A Command Line Interface (CLI) is a method of interacting with
a computer via a text terminal.

These are the interfaces that are available for testing. By their
nature, APIs and command line interfaces are easier to
automate than GUIs. Having the APIs and CLIs increases the
product testability and is encouraged to be included in the
product.
What is GUI Test Automation?
 GUI Test automation is the use of software to
control the execution of tests, the comparison of
actual results to expected results, the setting up
of test preconditions, and other test control and
test reporting functions

 QTP is a GUI automation framework designed


mainly for Windows and Web-based applications.
It works by identifying the objects in the
application UI or a web page and performing the
desired operations on them (like mouse clicks or
keyboard events)
Benefits of Test Automation
 Fast
 QuickTest runs tests significantly faster than human users.
 Reliable
 Tests perform precisely the same operations each time they
are run, thereby eliminating human error.
 Repeatable
 You can test how the Web site or application reacts after
repeated execution of the same operations.
 Programmable
 You can program sophisticated tests that bring out hidden
information.
 Comprehensive
 You can build a suite of tests that covers every feature in your
Web site or application.
 Reusable
 You can reuse tests on different versions of a Web site or
application, even if the user interface changes.

Discussion: What should be automated?


QuickTest Testing Process

Preparingto
Preparing to
Recording
Recording
record
record

Reporting
Reporting Enhancing
Enhancing
defects
defects yourtest
your test

Analyzing
Analyzing Debugging
Debugging
the testresults
the test results yourtest
your test

Running
Running
your test
your test
QuickTest Testing Process - Continued
 Preparing to record
 Before you record a test, confirm that your application and QuickTest are set to match the
needs of your test.
 Make sure your application displays elements on which you want to record, such as a toolbar
or a special window pane, for example, and that your application options are set as you
expect for the purposes of your test.
 Recording a session on your application
 As you navigate through your application or Web site, QuickTest graphically displays each
step you perform as a row in the Keyword View. A step is any user action that causes or
makes a change in your application, such as clicking a link or image, or entering data in a
form.
 Enhancing your test
 Inserting checkpoints into your test lets you search for a specific value of a page, object, or
text string, which helps you determine whether your application or site is functioning
correctly.
 Broadening the scope of your test, by replacing fixed values with parameters, lets you check
how your application performs the same operations with multiple sets of data.
 Adding logic and conditional or loop statements enables you to add sophisticated checks to
your test.
 Debugging your test
 You debug a test to ensure that it operates smoothly and without interruption.
 Running your test
 You run a test to check the behavior of your application or Web site. While running, QuickTest
opens the application, or connects to the Web site, and performs each step in your test.
 Analyzing the test results
 You examine the test results to pinpoint defects in your application.
 Reporting defects
 If you have Quality Center installed, you can report the defects you discover to a database.
Quality Center is the Mercury test management solution.
How Does QTP Automation work?
 QuickTest tests your dynamically changing application by learning and identifying test
objects and their expected properties and values and by storing the test objects.

 A test object is an object that QuickTest creates in the test to represent the actual object
in your application. QuickTest stores information on the object that will help it identify and
check the object during the run session.
 When you perform an operation on your application while recording, QuickTest:
 identifies the QuickTest test object class that represents the object on which you
performed the operation and creates the appropriate test object
 reads the current value of the object's properties in your application and stores the list
of mandatory and assistive properties and values with the test object
 chooses a unique name for the object, generally using the value of one of its
prominent properties
 records the operation that you performed on the object using the appropriate
QuickTest test object method
 The information about object properties is stored in the Object Repository.

 A run-time object is the actual object in your application on which methods are performed
during the run session.
 When you run a test, QuickTest identifies each object in your application by its test object
class and its description (the set of test object properties and values used to uniquely
identify the object).

Discussion: Name GUI Objects in Browser and Windows applications.


First Look at QuickTest

 Start > Programs


> QuickTest
Professional >
QuickTest
Professional
 Click Blank Test
 Examine the
QuickTest window
and toolbars
The View toolbar contains buttons for The Debug toolbar contains buttons for
viewing different elements of the the commands used when debugging
The Standard toolbar contains
QuickTest window. the steps in your test and any
buttons for managing a test or
associated function library.
function library.

The Insert toolbar contains buttons for the


The Edit toolbar contains buttons for the
The Automation toolbar contains buttons commands used when creating and
commands used when editing your test or
for recording and running your test. modifying your test steps and when working
function library.
with function libraries.

The Tools toolbar contains buttons for the


commands used to access tools that assist
you when working with your test.
Step 1: Preparing to record
 Determine the test scenario. In Notepad:
1. Type QTP Class 1 into Notepad document
2. Select Edit > Select All
3. Select Edit > Copy
4. Press keyboard End button
5. Press Enter key
6. Press Ctrl + V
 Open QTP and Notepad side by side
Step 2: Recording
 Click Record in QuickTest to start
recording
 In Record and Run Settings dialog select
Windows Applications
 Select radio button Record and run test
on any open Windows-based application
 Click OK
 Perform the test operations as described
in the previous slide
 Click Stop push-button in QuickTest
Saving the Script

 In QuickTest select File > Save


 Create a new folder for your test scripts
“[YourName]_QTP”
 Browse to the folder
 Name the file “Exercise 1”, click Save
QuickTest Views
 Keyword View
 The Keyword View enables you to create and
view the steps of your test in a keyword-
driven, modular, table format. The Keyword
View is comprised of a table-like view, in which
each step is a separate row in the table, and
each column represents different parts of the
steps.
 Expert View
 In the Expert View, QuickTest displays each
operation performed on your application in the
form of a script, comprised of VBScript
statements. The Expert View is a script editor
with many script editing capabilities.
Understanding the 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 Column. The item on which you perform the step (test
object, utility object, function call, or statement). Displayed in
a hierarchical icon-based tree.
 Operation column. The operation to be performed on the
item, for example, Type.
 Value column. The argument values for the selected
operation, for example, typed text.
 Documentation column. Auto-documentation of what the
step does, in an easy-to-understand sentence.
 Comment column. Any textual information you want to add
regarding the step. This column is not visible by default.
 Assignment column. 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.
Understanding the Keyword View -
Continued
Understanding the Expert View
 Each line of VBScript in the Expert View represents a step in the test.
 In the Expert View, an object's description is displayed in parentheses
following the object type. For all objects stored in the object
repository, the object name is a sufficient object description. In the
following example, the object type is Window, and the object name is
Notepad:
Window("Notepad")
 The objects in the object hierarchy are separated by a dot. In the
following example, Window and WinEditor are two separate objects in
the same hierarchy:
Window("Notepad").WinEditor("Edit").
 The operation (method) performed on the object is always displayed
at the end of the statement, followed by any values associated with
the operation. In the following example, the words “QTP Class 1” are
inserted in the Edit edit box using the Type method:
Window("Notepad").WinEditor("Edit").Type "QTP Class 1"

Tip: In Expert View pressing F1 key when the cursor is on method


displays information about the method.
Understanding the Expert View -
Continued
Step 5: Running a Script
 In QuickTest, click
Run
 In the Run dialog
select “Temporary
run results folder…”
 Click OK
 The test script
executes and the
results window
appears
 The execution looks
different than
expected
 Clear Notepad and
run again
Automated Test Script Steps

1. Drive the application to the base


state.
2. Perform the step according to a
particular test case.
3. Perform verification.
4. Drive the application back to the
base state.
Step 3: Enhancing a Script
 Drive the application to the base state
 Record: File > New
 Run the script
 No luck!!!
 Return the application to the base state
 Record: Edit > Select All; press Del key
on the keyboard
 Run the script again
Class Work
1. Create the script Exercise 1.
2. Is there another solution to make this script
run? Implement it.
3. Add selection of Font Name, Font Style and Font
Size in the Format > Font dialog.
4. Manually modify the Font Name, Font Style and
Font Size values in the expert view.
5. Experiment with different Run options in
Automation menu:
 Run
 Run Current Action
 Run From Step
Adding a Verification Checkpoint

 In the Keyword view


select the item that you
want to be verified
 Select Insert >
Checkpoint > Standard
Checkpoint
 Select the properties you
want to verify
 Click OK
 The checkpoint is added
 Run the script
 Make the script fail by
modifying the application
state
Steps 6 & 7: Analyzing the Results
and Reporting a defect
 Test Results file is generated after each test run
Practice! Practice! Practice!
 40 hours theory
 60 hours lab
 I can be a reference for top
students
Homework
 For the Exercise 1 script:
 Add if…then statement to the script for the
Notepad dialog (dialog that appears after File
> New selection)
 Create an identical script for WordPad
 Add checkpoints to the script
 Rename the action
 Make the script re-runnable
 Research other GUI automation tools and
do the feature comparison analysis (up to
5 tools)
Recommended reading

 QucikTest Professional Help

 QucikTest Professional Tutorial

 ‘Visual Basic Programming’


Automation Shortcuts
Automation Menu Commands
Command Shortcut Key Function

Record F3 Starts a recording session.

Run F5 Starts a run session from the beginning or from the line at which the session was paused.

Stop F4 Stops the recording or run session.

Run Current   Runs only the active action.


Action

Run from Step Ctrl+F5 Starts a run session from the selected step.

Update Run Mode   Starts a run session to update test object descriptions and other options (if applicable).

Analog Recording Shift+Alt+F3 Starts recording in Analog Recording mode.

Low Level Ctrl+Shift+F3 Starts recording in Low Level Recording mode.


Recording

Record and Run   Opens the Record and Run Settings dialog box, enabling you to define browser
Settings preferences for recording and running your test.

Results   Enables you to view results for a test run session.

También podría gustarte