Creating Tests and Test Cases

This chapter discusses how to:

Click to jump to parent topicCreating Tests

This section discusses how to:

Click to jump to top of pageClick to jump to parent topicCreating a New Folder

Each test, along with the related test cases and logs, is stored in a folder in the PTF Explorer tree structure.

To create a new folder:

  1. In PTF Explorer, highlight the folder in which you want to create the new folder or highlight Home to create the folder at the root level.

  2. Select Create, Folder.

  3. Enter a new folder name.

  4. Click OK.

Note. Folder names must not contain the following characters:

& ? / \ * < > ' "

Click to jump to top of pageClick to jump to parent topicCreating a New Test

To create a new test:

  1. Highlight a folder in PTF Explorer.

  2. Select Create, Test.

    The Test Editor launches with a new test.

  3. (Optional) In the Test Descr field, enter a description for the test case.

  4. (Optional) Click the Prop button to enter a long description of the test case.

    It is a good practice to provide a good description for a test, such as a description of the product, feature, or business process being tested. Test names are often short and provide little information.

  5. Select Test, Save or click the Save button in the toolbar.

  6. Enter a name for the new test.

  7. Click OK.

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

These rules apply to test names:

Click to jump to top of pageClick to jump to parent topicCopying a Test

To copy a test:

  1. Highlight a test in the PTF Explorer.

  2. Select Edit, Copy or press CTRL-C to copy the test.

  3. Highlight the folder where the test is to be located.

  4. Select Edit, Paste or press CTRL-V to paste the test.

  5. Enter a name for the new test.

When you copy and paste a test the test cases are copied as well, but not the logs. When you cut and paste a test the logs are moved also.

Click to jump to parent topicRecording Tests

When you record a test, PTF monitors each action you perform in the target application and creates a corresponding step in the test.

PTF Recorder populates these fields for each step:

This is an example of test steps:

Seq and ID are system-generated fields.

Scroll ID is populated by the developer only for scroll actions.

Recognition and Value are not used with some actions, such as Browser.Start or Page.Save.

For a complete description of test steps, see “Test Step Fields.”

See Test Step Fields.

See Also

PTF Test Language

Click to jump to top of pageClick to jump to parent topicRecording a Test

To record a test:

  1. Create a new test or open an existing test.

  2. If you are recording within an existing test, highlight a test step. The system inserts the steps in the new recording following the highlighted step. If you are recording a new test, recording begins at Step 2. Step 1 is always Browser.Start or Browser.Start_Login. For an explanation of the difference between Start and Start_Login, see “PTF Test Language Reference.”

    See Browser.

  3. With a test open, select Test, Open Test Recorder or click the Show Test Recorder button in the toolbar.

  4. The Recorder toolbar appears.

    See Using the PTF Recorder.

  5. Hook a browser, that is, associate a PeopleSoft application browser with the test.

    To hook a browser, you can either:

  6. Click the Start Recording button in the Recorder toolbar to begin recording.

  7. Perform the test steps in the PeopleSoft application.

  8. Click the Stop Recording button in the Recorder toolbar to end the recording.

  9. Save the test.

Click to jump to parent topicCreating Test Cases

Often, you will want to run the same test multiple times using different values in the Value column. Test cases enable you to associate different sets of data with a test. You can view and edit both the test and test case in a single unified window.

Click to jump to top of pageClick to jump to parent topicCreating a New Test Case

To create a new test case:

  1. With a test open, click the New button to the right of the Test Case field.

  2. Enter a name for the new test case.

  3. (Optional) In the Test Case Descr field, enter a description for the test case.

  4. (Optional) Click the Prop button to enter a long description of the test case.

    It is a good practice to provide a good description for a test case. Test case names are often short and provide the user with little information.

  5. The new test case provides a set of new, empty Value fields for all the steps of the test.

    Enter a new value for each step that requires a value.

  6. Save the test case.

This example shows a new test case with blank values:

Click to jump to top of pageClick to jump to parent topicCreating a Test Case With Values

For convenience, you may want to create a test case with the Value column populated with the values from the original test or from another test case. Then, you can edit the values in the new test case.

Note. The test case associated with the original test is named DEFAULT. Every test has one test case named DEFAULT.

You can select an existing test case from the Test Case drop-down list box.

PTF displays the number of test cases associated with the test, including the DEFAULT test case, next to the Test Case field label.

To create a test case with values:

  1. With a test case open, select Test, Test Case Save As.

  2. Enter a name for the new test case.

  3. (Optional) Enter a short description and a long description for the test case.

  4. Highlight each value you want to change and enter a new value.

  5. Save.

Click to jump to parent topicExecuting Tests

This section describes how to execute tests and test cases.

Click to jump to top of pageClick to jump to parent topicExecuting a Test

To execute a test:

  1. With a test open in PTF, select Test, Run.

    Alternatively, you can press F5 or click the Run button.

  2. If Yes is specified in the Prompt for Options field for the default execution option, then the Execution Options dialog box appears.

    Select an execution option from the list and click Accept.

    PTF opens the PeopleSoft application specified in Execution Options and executes the steps in the test.

  3. After the test executes, PTF opens the test log in the Log Viewer.

Note. When PTF executes a test it disables Num Lock and Caps Lock on your keyboard and restores them when the test completes. If the execution terminates abnormally, the test does not complete, or hangs up, and PTF does not restore Num Lock and Caps Lock. Select Test, End or click the End icon in the toolbar to end the test and restore Num Lock and Caps Lock.

See Also

Reviewing Test Logs

Click to jump to top of pageClick to jump to parent topicExecuting a Test Case

To execute a test case:

  1. With a test open in PTF, select a test case from the Test Case drop-down list.

    If you do not select a test case, the system uses the DEFAULT test case.

    Alternatively, you can open a test case from PTF Explorer.

  2. Select Test, Run.

  3. Review the log in the Log Viewer.

See Also

Reviewing Test Logs

Click to jump to top of pageClick to jump to parent topicExecuting a Test from the Command Line

You can also execute a test from the command line.

Syntax

Use this syntax to execute a test using existing environment connection:

PsTestFw -CD=ConnectionName -CP=ConnectionPassword -TST=TestName -TC=TestCaseName [-PFX=Prefix] -EXO=ExecutionOption [-LOG=LogFileName]

Use this syntax to explicitly specify connection parameters:

PsTestFw -CD=ConnectionName -CP=ConnectionPassword -TST=TestName -TC=TestCaseName [-PFX=Prefix] -EXO=ExecutionOption [-LOG=LogFileName]

Parameters

Parameter

Description

–CD=

Specify the name of the environment signon to use for connection. This is the Database Name you would select in the PeopleSoft Test Framework Signon dialog box when signing on to PTF.

The environment signon settings are stored in the environments.xml file in the PTF data directory (C:\Documents and Settings\<User>\Application Data\PeopleSoft\PeopleSoft Test Framework by default). If the environment connection data is not set in the environments.xml file, the you can explicitly specify the connection parameters. See the following table for a description of connection parameters.

See Creating a Connection to a PTF Environment.

–CP=

Specify the user password.

–TST=

Specify the test name.

–TC=

Specify the test case name.

–PFX=

(Optional) Specify the prefix.

See #PREFIX#.

–EXO=

Specify the execution option to be used in the execution.

Note. The name of the execution option must not contain the following characters:

spaces & ? / \ * < > ' "

–LOG=

(Optional) Specify the name for the log file. The default is unattended.log.

If you do not use the -CD= parameter to specify the connection data, use the parameters in the following table:

Parameter

Description

–CS=

Specify the server:port to connect to. This is the Server:Port value you would enter in the PeopleSoft Test Framework Signon dialog box when signing on to PTF.

–CNO=

Specify the node name.

–CO=

Specify the user name. If you use network authentication, user the DOMAIN\USER format.

–PS=

Specify the ProxyServer:Port.

–PU=

Specify the proxy user.

–PP=

Specify the proxy password.

Example

The following example uses the –CD= parameter to set connection parameters:

PsTestFw -CD=QE851 -CP=VP1 -TST=TEST_CMD_LINE -TC=DEFAULT -PFX=Prefix -EXO=QE851_No_Folder -LOG=my_run_log

The following example explicitly sets connection parameters:

PsTestFw -CS=rtdc796vmc:443 -CNO=PT_LOCAL -CO=VP1 -CP=VP1 -TST=TEST_CMD_LINE -TC=DEFAULT -PFX=Prefix -EXO=QE851_No_Folder -PS=Proxy_Server:2345 -PU=mydomain\username -PP=pwd123 -LOG=my_run_log

Log File

The execution will generate an output log file in the PTF data directory (C:\Documents and Settings\<user>\Application Data\PeopleSoft\PeopleSoft Test Framework by default).

If the log file exists it will be overwritten.

This is an example of a log file for a passed execution:

<execution> <Started>2010-07-27 16:49:47</Started> <Param> <Database>QE851</Database> <TestName>TEST_CMD_LINE</TestName> <TestCase>DEFAULT</TestCase> <Prefix>01</Prefix> <ExecOpt>QE851-Folder</ExecOpt> </Param> <Status>Passed</Status> <Test> <LogFolder>Folder</LogFolder> <LogName>48. VP1 2010-07-27 16:49</LogName> </Test> </execution>

This is an example of a log file for a failed execution:

<execution> <Started>2010-07-27 16:47:07</Started> <Param> <Database>QE851</Database> <TestName>TEST_CMD_LINE</TestName> <TestCase>DEFAULT</TestCase> <Prefix>01</Prefix> <ExecOpt>QE851-Folder</ExecOpt> </Param> <Status>Not Completed-FatalError</Status> <Test> <LogFolder>Folder</LogFolder> <LogName>46. VP1 2010-07-27 16:47</LogName> <Message>Browser not initialized.</Message> </Test> </execution>

Click to jump to parent topicReviewing Test Logs

Whenever you run a test, PTF creates an execution log entry. The log is located in PTF Explorer under the test name, in the log folder specified in Execution Options.

After you run a test, PTF automatically displays the log in the Log Viewer.

You can also view a log by opening it from PTF Explorer.

This example shows log entries in the Logs folder of PTF Explorer:

To open a log from PTF Explorer, do one of the following:

This example shows log entries in a test log:

Typically, the Log Viewer includes one high-level entry for each step in the test. Entries for complex steps appear in collapsible sections that can be expanded to view the additional details.

An icon or shaded label appears next to each log entry, indicating the success state of the associated step:

or

Information message only.

or

Information message only.

or

Step was successful.

or

Step was successful, but with a warning.

or

Step failed.

or

The test encountered a condition that it was not configured to handle, or the test encountered an error while PTF was configured to stop on all errors.

Highlight a log entry and select Detail, Go to Test Step or right-click and select Go to Test Step to open the test with the corresponding step selected.

See Also

Interpreting Logs