Test a GUI application with checkpoints

UFT One 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 One runs your test.

Do the following:

  1. Start with the MyFlightApplication solution open in UFT One.

    If you've closed and opened UFT One, 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. In UFT One, open the FlightConfirmation action in the MyFlightCheckpoint test, in the Keyword View.

  2. Select the passengerName step row.

    Do this by clicking the vertical ellipsis in the left margin's gray area, adjacent to passengerName. Clicking in the Item column will select the object only, and not the step.

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

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

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

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

  7. 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.

  8. 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.

  9. 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 One, 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 One 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 One 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 Test a GUI application with checkpoints.

Back to top

Add a text checkpoint

In the previous exercises, you added checkpoints to a regular test object and a table object. In this object, you will add a text checkpoint to your test to check the text inside an object that appears at the end of the order process.

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 One, 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 One
    • 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 a GUI application with output values.

Back to top

Parameterize passenger name

Parameterize the passenger name to use different names from a data table.

Note: This exercise is recommended for advanced users.

Do the following in the FlightConfirmation action:

  1. In Keyword view, select passengerName.Set.
  2. Select Tools > Data Driver.
  3. In the Data Driver dialog box, select Mary Sanchez and click Parameterize.
  4. In the Data Driver wizard, select Parameterize all and Parameter.

  5. Click the Edit button and type passengerName in the Name field. Click OK.

  6. In the Data Driver wizard, click Finish. Then click OK. View the code.

  7. In the Data > Global sheet, enter several passenger names.

  8. Run the test.

Back to top

Parameterize a checkpoint

Parameterize the checkpoint to use different values from a data table.

Note: This exercise is recommended for advanced users.

Do the following in the FlightConfirmation action:

  1. In Edit view, right click the CheckOrderCompletedText checkpoint, and select Checkpoint Properties.
  2. Select Parameter and click the Edit button .
  3. In the Parameter Options dialog box, enter CheckOrderCompletedTextChecked_Text in the name field, and click OK.

  4. In the Data > Global sheet, enter several checkpoint names.

  5. Run the test.

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 One.
  2. In the toolbar, click the Object Repository button .
  3. Scroll down to the bottom to view the checkpoints you added in this exercise.
  4. Select a checkpoint to view or update its properties on the right.

Back to top

Next steps: