7.0 Building Test Scripts

Building your SAP application test scripts requires the HP Quality Center, a robust application that provides many test management functions.

SAP TAO components should not contain flow logic or operations that span multiple SAP screens or views. An ideal component contains a small number of operations and can function independently. An example of a SAP TAO component is entering an activity. The component definition only contains the steps required to complete the form or applet. It does not include application logic, such as clicking on the New or OK button. You can add these buttons as separate components during the script building process.

Some operations are always performed together; therefore it is makes sense to group these together in a
component. For example, whenever a user clicks a Query button, the next step requires the user to perform the
query, followed by clicking GO.


HP Quality Center buttons and actions that you use to build test scripts. Use the Test
Plan section in Business Components to build a test script. Refer to the HP Quality Center documentation for
information about other functionality.


To log on to HP Quality Center
1. On the upper right corner of the SAP TAO Client, click the HP Quality Center link to open the HP Quality Center Home Page.
2. Click HP Quality Center on the Quality Server Home Page.
3. On HP Quality Center Home Page, enter your user ID and password.
4. Click Authenticate. If you checked “Automatically log in to my last domain and project on this machine,” HP Quality Center automatically completes the fields with your domain and project and logs you in.


Building a Test Script

Use the Test Plan module in HP Quality Center to build a test script.

To build a test script
1. Navigate from Business Components to Test Plan in HP Quality Center.
2. Click Test Plan.
3. To create a new folder:

a. Click Tests.
b. Select New Folder.
c. Enter a name for the folder.
d. Click OK.

4. To create a new test:
a. Select the folder where you want to save the test.
b. Select New Test. A pop-up dialog box opens.
c. Select Business Process from the pull-down test type.
d. Enter a name for the Test.
e. Click OK. The Details tab displays your name, the test name, the creation date, and the status.

5. Click the Test Script tab to build your script. A components tree opens in the right column. Navigate to the location on the components tree where your transactions are stored.
6. Navigate to the Actions folder: Business Components/Components/SAP R3/Common Functions/Actions

a. Open the Actions folder and navigate to Initialize Script.
b. Make the first component in the test plan Initialize Script if you plan to parameterize the values in this script.
c. Initialize Script adds a link in the test script title to the Excel spreadsheet. See the next section,Parameterizing the Elements in the Test Script, for more information.

7. Use drag and drop commands, buttons, and transactions as needed to create the test.
8. Save the disk. Use the small disk icon. After you build the script, verify that you have added all the necessary elements in a logical order. Once you have verified the elements, you may parameterize elements or proceed to the next chapter to consolidate the test script.


Parameterizing the Elements in the Test Script

Parametrization allows a business component to receive data from an external source, or to return data for use in other components. You can store the parameterized elements in an Excel spreadsheet or in the HP Quality Center custom database.

SAP TAO provides an Excel spreadsheet to store parameters. The Initialization Script that you create in the HP Quality Server Test Plan specifies the name of the associated spreadsheet.

All parameters that you intend to store in the Excel spreadsheet must use the DT_ prefix. The DT_prefix parameters are useful for storing and creating variables that change from execution to execution. For example, a payroll application may include a current date that changes from week to week. By storing the parameter in an Excel spreadsheet, you can create a function to update it. SAP TAO reads the new value from the spreadsheet each time you re-execute this script.

If you parameterize a value, but do not include the DT_ prefix, the value becomes static or hard-coded. Designate a value as hard-coded when it stays the same from one execution to the next. When you hard code a value into a parameter, the HP Quality Server inserts this exact value each time it encounters this parameter in a test script.


To create a SAP TAO parameter entry
1. Open the test script that you want to parameterize.
2. Click the data value that you want to parameterize. The Components Iteration window opens.
3. Enter the value and include the DT_ prefix to the data value name.
4. Specify whether this value is output for use in another component, or whether you want to save it for reuse.
5. (Optional) You may enter an description for this value.
6. Click OK.
Follow these six steps to parameterize as many values as required.


To create a hard-coded parameter entry
1. Open the test script.
2. Click the data value that you want to parameterize. The Components Iteration window opens.
3. Enter the value.
4. Specify if this value is output for use in another component or whether you want to save it.
5. (Optional) You may enter an description for this value.
6. Click OK.

No comments: