Skip to Main Content
Return to Navigation

Incorporating Scroll Handling

This section discusses how to incorporate scroll handling in PTF tests.

Data on a PeopleSoft component is organized hierarchically using rowsets, or scrolls, and rows.

A scroll can be implemented as a scroll area or a grid. In scroll areas, the fields appear on the page in a freeform manner. In grids, fields appear as columns similar to those on a spreadsheet. Individual rows of data within a scroll or grid are uniquely identified by a set of one or more fields, or keys.

PTF references a field on a scroll by the field name and the row number. The PTF scroll handling feature enables a test to identify a row number at test execution time based on the keys for that row.

For example, suppose you have a test requirement that says:

12. Verify that the QEDMO user profile has the PTF Administrator role.

Here is an example of the Roles page for the QEDMO user profile:

Image: Example of the User Profile - Roles page

This example illustrates the fields and controls on the Example of the User Profile - Roles page.

Example of the User Profile - Roles page

When you record the test, PTF generates a step similar to the following example:

Image: Test step to verify a field on a scroll area

This example illustrates the test step to verify a field on a scroll area. You can find additional information on this step later on this page.

Test step to verify a field on a scroll area

The step uses two elements in the Name= parameter in the Recognition column to reference the Role Name field: the name of the field (PSROLEUSER_VW_ROLENAME) and its row position index ($0). A row position index is composed of a dollar sign ($) and an integer. The integer count starts at zero, so indexes for a scroll containing 11 rows are $0 through $10.

This test will work as recorded until something changes the grid position of the row that contains PTF Administrator. For instance, if another row is inserted before PTF Administrator, the PTF Administrator row position index changes to $1, and the test fails. The same problem occurs if the grid is sorted differently, or if a test case tests a different user profile, such as QEMGR.

Using a Dynamic Position Index

You can use the Scroll.Key_Set action and a Scroll.Action step to locate a row by key and generate a dynamic position index variable. Then you can use the dynamic position index variable to reference a row or a field reliably and repeatably because the variable is regenerated each time the test is run.

For example, instead of looking at the first row, PTF looks for the row where the key equals “PTF Administrator”.

If the value exists in the scroll, the test finds it, takes the specified action, and returns the position index.

If it does not find the value in the first displayed set of rows, PTF clicks the Show Next Rows icon on the scroll and continues searching until it has found the key value or searched all rows on all pages of the scroll.

Follow these steps to use a dynamic position index variable:

  1. Create Key_Set steps.

  2. Create an Action step

  3. Use the index variable for other steps.

  4. Specify the Scroll ID.

Creating Key_Set Steps

Create one Key_Set step for each field in the scroll key. If the key consists of three fields, create three Key_Set steps and specify key values for each of the three fields.

Note: You can create Key_Set steps and Action steps during recording.

See Using the PTF Test Recorder.

You can insert Scroll steps during recording or you can add them afterward. The following process explains how to insert and modify key steps manually. Even if you record Scroll steps, you may need to modify them using some of these concepts.

Key_Set requires two parameters in the Recognition column; Type= and Name=. You can get these values by recording a step with the PTF recorder and then manually modifying the recorded step or by copying the information from the application using the Message tool and pasting into a step.

Specify the field value in the Value column. You can use the PTF Recorder or Message tool to get the field value as well.

Image: Example of the Message tool

This example illustrates the Message tool with recognition data for the Role Name field.

Example of the Message tool

Here is an example of a test step that references a row on a scroll. This step checks for the existence of PTF Administrator in the Role Name field:

Image: Example of a step that verifies a field on a row

This example illustrates a test step that references a row on a scroll.

Example of a step that verifies a field on a row

This is one way to convert the step in the example to a Scroll.Key_Set step:

  1. Change the Type to Scroll.

  2. Change the Action to Key_Set.

  3. Add Type=Text; to the Recognition column.

  4. Leave the Name parameter in the Recognition column, but remove the row position index ($0).

    This signals PTF that the actual row number for the key is not yet known.

Image: Example of a Scroll.Key_Set step

This example illustrates a Scroll.Key_Set step that sets the key to PTF Administrator.

Example of a Scroll.Key_Set step

This step defines the key value, but PTF does not take an explicit action on the page based on the key until it executes an Action step.

Creating an Action Step

Create an Action step, based on what action you want to take on the row, such as update, insert, select, and so on. All of the available actions are detailed in the PTF Language Reference.

In this example, you want to select a row, so enter sel in the Value field.

The Action step attempts to locate a row defined by Key_Set. If a row is found, it returns the index of the row. Use the ret= parameter of the Action step to populate an index variable with the row index value.

Image: Example of an Action step

This example illustrates an action step.

Example of an Action step

Using the Index Variable

Now that you have the row position stored in the index variable, you can use that value to reference other fields on that row.

For instance, suppose you want to verify the Dynamic checkbox. You can use the PTF Recorder or the Message tool to get its name and position and create a step similar this one:

Image: Example of step using positional reference

This example illustrates a step with a positional reference.

Example of step using positional reference

This step has the problem that the positional reference is static, so it won’t work if the position changes. To fix that, replace the position index with the index variable.

This example shows a step that uses an index variable following the steps that locate the key and set the index variable:

Image: Example of a step using an index variable

This example illustrates a step using an index variable.

Example of a step using an index variable

Now whenever the test is run, the index variable is updated dynamically by the Key_Set and Action steps and the positional reference is accurate.

Specifying the Scroll ID

Assign a Scroll ID to group Scroll actions for each scroll. Use a different scroll ID and scroll variable for each different scroll area. You can assign any integer you like, as long as it is unique.

Scroll ID is a required field for Scroll actions.

If you are taking multiple actions in the same scroll, using the same scroll ID and scroll variable improves performance over using a new scroll ID.

In this example, the test defines two Action steps that both act on the same scroll. The first action verifies that the user profile does not contain the PTF Administrator role. The second action verifies that the user profile does contain the PTF User role. You would assign the same Scroll ID number to all four of the Scroll steps because they all act on the same scroll.

Image: Example of assigning Scroll IDs to Scroll steps

This example illustrates assigning scroll IDs to scroll steps.

Example of assigning Scroll IDs to Scroll steps