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:
When you record the test, PTF generates a step similar to the following example:
The step uses two elements
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 repeatedly 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:
Create Key_Set steps.
Create an Action step.
Use the index variable for other steps.
Specify the Scroll ID.
Note: You can accomplish all of the steps in this section during recording using features of the PTF Recorder Tool Bar. The manual process is provided to illustrate how information is shared between the different scroll-handling step types and how it can be manipulated manually after recording, if necessary.
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.
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;
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.
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:
This is one way to convert the step in the example to a Scroll.Key_Set step:
Change the Type to Scroll.
Change the Action to Key_Set.
Add Type=Text; to the Parameter column.
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.
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
of the Action step to populate an index variable with the row index
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:
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:
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.