Test with checkpoints

UFT checkpoints verify that expected information is displayed in your app while the test is running.

This exercise describes how to insert various types of checkpoints, and use a function to check the validity of the objects in the MyFlight sample app.

Create a new test for checkpoints

Create a copy of your existing MyFlight test, where you can add checkpoints then see the differences in how UFT runs your test.

Do the following:

  1. Start with the MyFlightApplication solution open in UFT.

    If you've closed and opened UFT, make sure you start it with the WPF Add-in loaded.

  2. In the Solution Explorer, right-click the MyFlight test node, and select Save As.

  3. Save the test in the same location (C:\Users\<username>\Documents\Unified Functional Testing).

    In the File name field, enter MyFlightCheckpoint, and then click Save.

The Solution Explorer switches to display MyFlightCheckpoint test instead, with all the same actions and steps as the original MyFlight test.

Tip: To display all of your tests at the same time, add the MyFlight test back to your solution.

In the Solution Explorer, right click the solution node, and select Add > Add Existing Test. Select the MyFlight test.

Back to top

Add a standard checkpoint

Add a standard checkpoint to verify the value entered for the Passenger Name field in the MyFlight app Flight Details window.

Do the following:

  1. Open the MyFlight app to the FLIGHT DETAILS page. Log in, and search for, and select a flight.

    For details, see Flight GUI layer.

  2. In UFT, open the FlightConfirmation action in the MyFlightCheckpoint test, in the Keyword View.

  3. Select the passengerName step row.

    Do this by selecting in the right margin of the grid, instead of clicking in the Item column. Clicking in the Item column will select the object only, and not the step.

  4. Select the Design menu > Checkpoint > Standard Checkpoint.

  5. In the Checkpoint Properties dialog, enter CheckName in the Name field.

  6. Scroll down in the grid, and select the row that contains the text property name.

  7. Click in the Value column, and then select Constant in the Configure value area below the grid.

  8. In the Constant field, enter Mary Sanchez. This is the value you entered in the Passenger Name field, in the first step of the action.

    Note that the value in the grid is updated as well.

  9. In the Insert statement area at the bottom of the dialog, select After current step.

    Accept the other default settings, and click OK.

    Back in the Keyword View, the checkpoint step is added after the passengerName Set step.

    Tip: To learn more about the checkpoint properties, right-click on the checkpoint step and select Checkpoint Properties to open the dialog again.

    Then click the help button in the top-right corner of the dialog to open the relevant Help Center page with more details.

  10. Save your test, and continue with Add a table checkpoint.

Back to top

Add a table checkpoint

Add a table checkpoint to verify a price value in the flights grid on the MyFlights sample app Select Flights page.

Do the following:

  1. Open the MyFlight app to the SELECT FLIGHT page. If the MyFlight GUI app is already open, click NEW SEARCH to start again.

    Search for a flight using the same data you used in the FlightFinder action. This will ensure that the price you are checking for matches the value that the test searches for.

    For more details, see Flight GUI layer.

  2. In UFT, open the SelectFlight action in the MyFlightCheckpoint test, in the Keyword View.

  3. Select the flightsDataGrid step, which selects the specific flight to book.

  4. Configure UFT to record on the open page in the MyFlight app.

    Select Record > Record and Run Settings. In the Windows Applications tab, select the Record and run test on any open Windows-based application option, and click OK.

  5. Click Record . The main UFT window is hidden as your recording session begins.

  6. In the record toolbar, click the Insert Checkpoint or Output Value drop-down arrow , and select Standard Checkpoint. The mouse pointer turns into a pointing hand.

  7. In the MyFlights app, click the flights table.

    The Standard Checkpoint dialog appears, with the WpfTable : flightsDataGrid object selected.

  8. Click OK to continue.

    In the Define Row Range dialog that appears, ensure that the All rows option is selected, and click OK.

    The Table Checkpoint Properties dialog appears, showing a table with cells that represent the MyFlights table.

    For example:

    By default, all cells are selected, which means that all cells would be checked.

  9. Enter CheckCost in the Name field at the top to name your checkpoint.

    Then double-click each column header in the grid to clear all selections. Scroll to the right to ensure you cleared all columns.

  10. Scroll back to the first column, and double-click the cell in row 1, column 0 to select only the first cell in the top-left. For example:

    The value in this cell should match the value on SELECT FLIGHTS page using the values in the FlightFinder action.

  11. Accept the other default settings, and click OK.

  12. In the recording toolbar, click Stop .

    Back in the Keyword View, the checkpoint step is added after the flightsDataGrid SelectCell step.

    In the Editor, the test looks like this:

    WpfWindow("Micro Focus MyFlight Sample").WpfTable("flightsDataGrid").SelectCell "0", "0"
    WpfWindow("Micro Focus MyFlight Sample").WpfTable("flightsDataGrid").Check CheckPoint("CheckCost")
    WpfWindow("Micro Focus MyFlight Sample").WpfButton("SELECT FLIGHT").Click
  13. Save your test, and continue with Add a text checkpoint.

Back to top

Add a text checkpoint

Add a text checkpoint to your test to verify the text shown in the MyFlights app at the very end of the order process.

Do the following:

  1. Open the MyFlight app to the ORDER DETAILS page.

    If the MyFlight GUI app is already open, continue through the wizard to fully book a flight.

    On the FLIGHT DETAILS page, click ORDER to complete the order, until you see message indicating that the order was completed. For example:

    The order number will change with each flight you reserve. For more details, see Flight GUI layer.

  2. In UFT, open the FlightConfirmation action in the MyFlightCheckpoint test, in the Keyword View.

  3. Add a step to wait until the progress bar reaches 100%. This ensures that the message appears before you perform a checkpoint.

    1. From the Toolbox pane, drag the object into the Item column in the Keyword View, below the ORDER step.
    2. Click in the Operation cell, and select the WaitProperty method.
    3. In the Value cell, enter "value", "100", and press ENTER.

    In the Editor, your progBar step has the following syntax:

    WpfWindow("Micro Focus MyFlight Sample").WpfProgressBar("progBar").WaitProperty "value", "100"
  4. Click the right margin of the grid on the new progBar step. This selects the step, and UFT will add the checkpoint step below it.

  5. Ensure that UFT's record and run settings are set to record on the current page.

    Select Record > Record and Run Settings, and confirm that the Record and run test on any open Windows-based application option is selected.

    Click OK to close the dialog.

  6. Click Record . The main UFT window is hidden as your recording session begins.

  7. In the record toolbar, click the Insert Checkpoint or Output Value drop-down arrow , and select Text Checkpoint. The mouse pointer turns into a pointing hand.

  8. In the MyFlights app, click the Order # Completed message to select it.

    The Text Checkpoint dialog appears, with the WpfObject : Order <#> completed object selected.

  9. Click OK to continue.

    Then, in the Text Checkpoint Properties dialog that appears, enter CheckOrderCompletedText in the Name field.

  10. In the Text Checkpoint Properties dialog, under the Checkpoint Summary area, click Configure.

  11. In the Configure Text Selection dialog that appears, highlight the word completed, and then click Checked Text at the bottom of the dialog.

    The rest of the string turns from red to grey. For example:

  12. Click OK to return to the Text Checkpoint Properties dialog, which is now updated.
  13. Accept the other default selections, and click OK to close the Text Checkpoint Properties dialog.
  14. In the recording toolbar, click Stop .

    Back in the Keyword View, the checkpoint step is added after the progBar step.

    In the Editor, the test looks like this:

    WpfWindow("Micro Focus MyFlight Sample").WpfEdit("passengerName").Set "Mary Sanchez"
    WpfWindow("Micro Focus MyFlight Sample").WpfEdit("passengerName").Check CheckPoint("CheckName")
    WpfWindow("Micro Focus MyFlight Sample").WpfButton("ORDER").Click
    WpfWindow("Micro Focus MyFlight Sample").WpfProgressBar("progBar").WaitProperty "value", "100"
    WpfWindow("Micro Focus MyFlight Sample").WpfObject("Order 94 completed").Check CheckPoint("CheckOrderCompletedText")
    WpfWindow("Micro Focus MyFlight Sample").WpfButton("NEW SEARCH").Click
  15. Save your test, and continue with Run your checkpoint test.

Back to top

Run your checkpoint test

Run your checkpoint test to see how the checkpoints perform. If the checkpoints pass, this means they found the data they were configured to find, and the test passes.

If one or more of the checkpoints had failed, the test run is listed as Failed.

Do the following:

  1. If the MyFlights sample app is opened, close it.
  2. In UFT, select Record > Record and Run Settings.

  3. In the Windows Applications tab, select the Record and run only on: option, and ensure that the following options are selected:

    • Applications opened by UFT
    • Applications specified below

    The Flight GUI application details are still there from when you defined them earlier. For more details, see Run and analyze your GUI test.

  4. Click OK , and then click Run .

  5. In the Run dialog, ensure that the MyFlightCheckpoint test is selected in the Test Name dropdown.

    On the Results Location tab, ensure that the New run results folder option is selected.

    Accept the other default values.

  6. Click Run to run the test. In the run results, scroll down in the test flow to the following steps:

    • SelectFlight action > Standard Checkpoint: flightDataGrid
    • FlightConfirmation action > Standard Checkpoint: passengerName
    • FlightConfirmation action > TextCheckpoint: Order <#> completed

    Click each checkpoint step to view details about the data found during the test run.

Continue the tutorial with Test with output values.

Back to top

Manage checkpoints in the object repository

View checkpoints in the object repository to view and properties from there, especially when a checkpoint is reused in multiple places in your test.

Example: For example, you may want to create a checkpoint to verify that your company logo appears on each page in your app.

Create the checkpoint, and insert it in different actions in your test. Access it easily from the object repository instead of having to browse to its location each time you want to change it.

This tutorial does not include reusing checkpoints.

Do the following:

  1. Start with the MyFlightCheckpoint test and the FlightConfirmation action open in UFT.
  2. In the toolbar, click the Object Repository button .
  3. Scroll down to the bottom to view the three checkpoints you added in this exercise.
  4. Select a checkpoint to view or update its properties on the right.

Back to top

Next steps: