+ All Categories
Home > Documents > QTP-PPT-DAY2-CHAP5

QTP-PPT-DAY2-CHAP5

Date post: 04-Apr-2018
Category:
Upload: krishna-keshav
View: 215 times
Download: 0 times
Share this document with a friend

of 23

Transcript
  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    1/23

    Writing CustomCheckpoints

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    2/23

    Objectives

    After completing this lesson, you will be able

    to:

    Create a custom checkpoint. Compare captured parameter values with

    expected values.

    Use debug tools to investigate the causesof failure.

    Verify that the reported error message

    reflects the state of the test.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    3/23

    Using a Custom Checkpoint

    You use a custom checkpoint to:

    Verify dynamic values in the test using output parameters.

    Validate the test outcome as acceptable or unacceptable by using a

    conditional

    statement.

    Add a REPORTEVENT to report if the test outcome is acceptable.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    4/23

    Using a Custom Checkpoint

    Generating a Dynamic Value as Output

    Figure 11-1 Mercury Flight Application - Number of Tickets

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    5/23

    Using a Custom Checkpoint

    Quick Test enables you to capture values at a specific point in your test.

    Quick Test then stores these values as output values in the data table for

    the duration of the run session. You can then parameterize these output

    values and use them as input values at different stages in your run session.

    If two or more output parameters are related, you can use them as elementsof a formula to perform comparisons and calculations. For example, Figure

    11-1 shows an output parameter created for the TICKET field. In

    addition, Figure 11-1 shows using the ACTIVE SCREEN to get the

    OUTPUT VALUE.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    6/23

    Using a Custom Checkpoint

    Using Dynamic Data in an Output Parameter

    Figure 11-2 Output Parameter

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    7/23

    Using a Custom Checkpoint

    When you create an output parameter, QuickTest adds a column in the

    design-time DATA TABLE. To perform calculations on the output parameter

    values, parameterize all formula components to capture each dynamic

    value and use these values in a calculation formula. For example, you

    capture the number of tickets, the price of a ticket, and the total cost for a

    flight reservation based on the number of tickets purchased.The checkpointoutcome, which could be PASSED or FAILED, depends on the expected

    input or output value of a dynamic test.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    8/23

    Using a Custom Checkpoint

    Calculating the Outcome Value

    Figure 11-3 Price Check Column Added as New Parameter

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    9/23

    Using a Custom Checkpoint

    To create a custom checkpoint:

    1. Use the outcome values of at least two columns and perform calculation on

    these values.

    2. Store the outcome of the calculation in a new parameter.To name a new parameter column, double-click the column header that you

    want to parameterize. For example, Figure 11-3 shows that when you

    double-click column D in the design-time DATA TABLE, the CHANGE

    PARAMETER NAME dialog box appears. In the DATA TABLE COLUMN

    NAME field, you type PRICECHECK to store the value the checkpoint

    returns. The PRICECHECK column returns a TRUE value if the calculation,TICKETS * PRICE = TOTAL, evaluates to true.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    10/23

    Using a Custom Checkpoint

    Using Data Table Formula Capabilities

    Figure 11-4 Excel Calculation on Fields

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    11/23

    Using a Custom Checkpoint

    You can type a formula directly in the design-time DATA TABLE, as shown

    in Figure 11-4. Alternatively, you can use Microsoft Excel to type and save a

    formula to the DEFAULT.XLS file in the Quick Test test directory. When you

    run a test, the run-time values from the test are used to performcalculations. Based on the expected results of these calculations, you use

    the REPORTER object as a step to report the test outcome.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    12/23

    Using a Custom Checkpoint

    Viewing the Run-Time Data Table

    Figure 11-5 Test Results

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    13/23

    Using a Custom Checkpoint

    After you run the test, view the test results to check the output of the test

    calculations. In the TEST RESULTS window, from the menu bar, select

    VIEW EXPAND ALL to view the results of each test step. A TRUE valuein the PRICECHECK column of the RUN-TIME DATA TABLE indicates that

    the value is calculated corectly. Note:After a test executes, the dynamicvalues for the test are cleared from the designtime DATA TABLE. However,

    the information related to the dynamic values appears in the RUN-TIME

    DATA TABLE.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    14/23

    Using a Custom Checkpoint

    Adding the Data Table Object

    Figure 11-6 Adding the DataTable Object

    Figure 11-6 Adding the Data Table Object

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    15/23

    Using a Custom Checkpoint

    To add a DATATABLE object in a test:

    1. Use STEP GENERATOR to obtain the value of the PRICECHECK field.

    2. Choose the DATATABLE UTILITY OBJECT.

    3. Choose the VALUE operation to retrieve the value in the column.

    4. The PARAMETERID is the column name, PRICECHECK.5. Return the value into a variable.

    Note: Using the DATA TABLE UTILITY OBJECT you can also insertsheets, count the number of rows in the data table and import a data sheet.

    See Quick Test help for more information.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    16/23

    Using a Custom Checkpoint

    Adding a Conditional Statement

    Figure 11-7 A Conditional Statement

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    17/23

    Using a Custom Checkpoint

    You insert a conditional statement after the output steps that make up acalculation. The outcome of a conditional statement verifies whether a test

    passed or failed.

    The Debug Toolbar

    Figure 11-8 The Debug Toolbar

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    18/23

    Using a Custom Checkpoint

    To view the DEBUG toolbar, from the Quick Test Professional menu bar,

    select VIEWTOOLBARS DEBUG. The DEBUG toolbar consists of thefollowing buttons:

    PAUSE: Temporarily suspends a test. A paused test stops running when

    all previously interpreted steps are executed.

    STEP INTO: Runs the current step of the active test. If the current line callsanother action, the called action is displayed. The test pauses at the first

    line of the called action.

    STEP OVER: Runs the current step in the active test. When the current

    step calls another action, the called action is executed but not displayed.

    STEP OUT: Runs the current step until the end of the function, returns tothe calling component or function library, and then pauses the run session.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    19/23

    Using a Custom Checkpoint

    INSERT/REMOVE BREAKPOINT: Stops a test run at a specific step in the

    test. A red icon appears in the left margin of the step to indicate that a

    breakpoint is inserted on the step. The test runs until it reaches the

    breakpoint. You can examine or manipulate steps up to the breakpoint. To

    remove a breakpoint, click INSERT/REMOVE BREAKPOINT again.

    _Breakpoints are discussed later in this lesson. CLEAR ALL BREAKPOINTS: Removes all breakpoints within a test.

    ENABLE/DISABLE ALL BREAKPOINTS: Enables or disables all

    breakpoints within a test.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    20/23

    Using a Breakpoint

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    21/23

    Using a Custom Checkpoint

    You use breakpoints to instruct Quick Test to pause a run session at a

    specific step in a function. Quick Test pauses the run session when it

    reaches the breakpoint, before executing the step. You then examine the

    effects of the run up to the breakpoint and make any changes to the

    calculation variables, if required. You can then continue to run the test from

    the breakpoint. You can set breakpoints and temporarily enable or disable

    them. After you finish using breakpoints to debug the test, you can remove

    them from your test. For example, Figure 11-9 shows that a FALSE

    calculation results when the number of tickets changes from 2 to 5 but the

    PRICE and TOTAL values remain unchanged.

    Note: Ensure that the reported message evaluates both TRUE and FALSEtest results.

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    22/23

    Using a Custom Checkpoint

    Saving Still Images

    Figure 11-10 Setting Run Options to Save Still Images

  • 7/29/2019 QTP-PPT-DAY2-CHAP5

    23/23

    Using a Custom Checkpoint

    The default run options settings in Quick Test is to capture and save a step

    screen to test results only if an error is encountered. However, debugging

    your test may be easier if you configure the run option to capture and save

    the step screen, irrespective of the test result. This enables you to analyze

    the complete test run. To change the default run option:

    1. From the Quick Test Professional menu bar, select TOOLS OPTIONS RUN.

    The OPTIONS dialog box appears.

    2. From the SAVE STILL IMAGE CAPTURE TO RESULTS list, select

    ALWAYS.

    3. Click OK.


Recommended