Incorporating Best Practices

This chapter discusses PeopleSoft Test Framework (PTF) best practices, which can help you create more robust, efficient, and maintainable tests, and will help to ensure that PTF tests the specific application functionality that you want tested.

Click to jump to parent topicIncorporating PTF Best Practices

This section discusses how to incorporate these PTF best practices:

Click to jump to top of pageClick to jump to parent topicAdopt Naming Conventions

You should understand these PTF test asset naming limitations:

You will find it easier to manage test assets if you adopt a systematic naming convention that reflects important characteristics of the tests and test cases you create. Here are a few suggested test characteristics that you can incorporate in your PTF test names:

It may seem simpler to use folders to categorize tests by the above characteristics. However, folder names are often not visible to the tester and do not appear on some PTF reports, such as the Test Maintenance Report. So, regardless of whether you categorize tests by folder, it is helpful to build test characteristics into the names of your tests.

The following three test names are examples of a naming convention that reflects functionality, priority, and intended execution order:

Click to jump to top of pageClick to jump to parent topicRecord First

A critical best practice when automating with PTF is to record first, and record whenever possible, to drive as much information, including PeopleTools metadata, into the recorded test as possible.

You must assertively record every test step from the test. That is, even if the input fields are already set to the expected value, you must explicitly enter or set that value when recording. The recorder only captures actions that you take against objects during record time. If you skip an object during recording because it is already set to the desired value, the test will ignore it and fail if the default value of the same object is different during execution.

When you record a date field that includes a calendar object that enables the user to select a date, you must explicitly enter the date value in the edit box. Do not use the calendar to select a date.

You may need to perform two actions instead of one. For instance, if the test instructions say to select a check box but the check box is already selected, then you will need to deselect it first, and then select it. Then delete the extra step in your test.

If you need to add a new step to a test, select the spot in the test where the new step will occur and record the step at the insertion point. Recording a step is more likely to drive accurate information into your test than trying to construct the entire step by editing the fields through the Test Editor.

See Also

Recording Tests

Click to jump to top of pageClick to jump to parent topicDocument Tests

Make it part of your automation routine to take advantage of the description fields in PTF tests and test cases as often as possible. PTF test and test case names tend to be short and abstract, so longer descriptions will help you and future testers understand the functional purpose of available PTF tests and test data.

You can find description fields in:

Use the Log actions to make your tests self-documenting. For instance, you can add a Log.Message before a Test.Exec step to describe the test you are calling, and you can put a Log.Message in the called test to document what the test does.

Click to jump to top of pageClick to jump to parent topicClean Up Tests

Immediately after recording a test, review the recorded test data in the Test Editor and correct actions taken inadvertently during recording, such as:

Revise the recorded values in the Value field (for editable fields) and delete unneeded steps.

This might be a good time to evaluate whether you should incorporate reserved words and variables to replace static values that may be different when the test is executed.

See Also

Make Tests Dynamic

Click to jump to top of pageClick to jump to parent topicUse Execution Options

Employ execution options to take login information out of the test whenever appropriate. Suppose you have the following manual test step:

1. Log into your database as a user with the PeopleSoft User role.

Coding user-specific information into many tests may make future updates difficult if user IDs in the test environment are changed.

The following example shows how to make a recorded test easier to maintain by inactivating the sequence of steps that was recorded logging in (Steps 1 through 4) and replacing those steps with the single action, Browser.Start_Login, which takes the user ID and password from the execution options and enters them at the login page:

Example of using Browser.Start_Login

See Also

Configuring Execution Options

Start_Login

Click to jump to top of pageClick to jump to parent topicUse Page Prompting

PTF page prompting steps make tests more robust and repeatable by simplifying test data and replacing it with intelligence built into the step.

Page prompting functions replace explicit navigation in the test and take the user directly to the component search page by URL manipulation. A test with the navigation explicitly defined can break when the navigation changes, even though the application is working fine. Page prompting avoids this problem.

Tests that use page prompting are more repeatable. Consider the following test instruction:

1. At the Define Calculation search page, add a calculation with the name KUSPTEST or, if it already exists, update it.

Using page prompting, a single step can navigate directly to the search page and either update or add a key, whichever is needed.

See the Page type actions Prompt and PromptOK for more details.

See Also

Prompt

PromptOK

Click to jump to top of pageClick to jump to parent topicUse the Process Object Type

The Process object type with a Run action is useful for running processes through Process Scheduler.

Suppose you have the following test scenario:

From the Request Calculation page, click the Process Monitor link. In Process Monitor, click the Refresh button until either Success or Error appears in the Run Status column for your process instance.

Replacing a recorded sequence of steps with the Process.Run step will make your test more robust. It will be less likely to fail if a change in performance affects processing time or if a PeopleTools enhancement modifies the structure of the Process Monitor page.

See Also

Process

Click to jump to top of pageClick to jump to parent topicMake Tests Dynamic

Many tests involve values and conditions that are not known until a test runs. Advanced functionality in PTF enables you to build tests that adapt to the application when necessary.

These examples of test scenarios can exploit the dynamic test features of PTF:

Dynamic steps improve the reusability and maintainability of tests.

As you are recording, be sure to make a note of situations that require dynamic handling so you can replace the recorded steps values with the appropriate dynamic construct that will ensure that the test will work at execution time.

See Also

Using Variables

Using Conditional Logic

Incorporating Scroll Handling

Using Reserved Words

Click to jump to top of pageClick to jump to parent topicReduce Duplication

Avoid creating tests and test steps that are duplicated elsewhere. When multiple tests validate similar functionality, it increases the complexity of test maintenance and the amount of manual work necessary to add or change test functionality later.

Take these steps to help keep test duplication to a minimum:

See Also

Creating Test Cases

Calling Tests