Oracle® Application Testing Suite OpenScript User's Guide Version 9.10 for Microsoft Windows (32-Bit) Part Number E15488-03 |
|
|
View PDF |
OpenScript allows users to parameterize script data inputs to perform data driven testing using Databanking. Users can select any data inputs for their script and then substitute a variable to drive the input from an external file during playback. Multiple Databank files can be attached to a single script and users can specify how OpenScript assigns data during script playback.
Data Driven Testing, or parameterization, allows you to quickly and efficiently create automated data-driven tests.
The OpenScript Modules record parameters defined by each page of the Web application to a script. Databanks are used to hold unlimited amounts of input data that can be automatically fed as parameters into your Web application when the script is run. You can use the OpenScript Databanking features to define variable values in script parameters and substitute values from Databank files for the variable values.
During playback, the parameters in the Web page are filled with values from the Databank file. Databank files can be easily created or modified using any simple text editor, spreadsheet, word processor, or database application. Users can create sophisticated unattended regression tests to thoroughly exercise a Web application by using varied input data from Databank files.
Data Input Parameterization enables users to parameterize recorded script inputs to perform data driven testing in either the script GUI view or code view. These inputs could be form field inputs for Web applications but could also be other types of script inputs that users may parameterize. Types of inputs users may parameterize include:
Any user entered input data (i.e. parameterize the data I entered for the search field)
Test case values (i.e. parameterize a text string for validation so I can use different inputs for comparison during playback)
Recorded navigations (i.e. parameterize a starting navigation so I can navigate to different host servers during playback)
Recorded user actions/object identified (i.e. parameterize a link object path so I can click on different links during playback)
Data Input Sources enables users to drive input values from an external CSV file or other external data source such as a database (i.e. using a database query to pull inputs from a database table).
Data Parameterization GUI View enables users to configure the inputs they want to parameterize and the data source they want to drive the inputs from through a substitute variable GUI interface. For example, the "ticker" query string parameter for "Page [4] Ticker List" in the following Tree View is set to the variable value "{{fmstocks_data.ticker,ter}}".
Within the variable "{{fmstocks_data.ticker,ter}}", "fmstocks_data" is the name of the Databank file, ".ticker" identifies the field name within the Databank file, and "ter" is the recorded value.
Data Parameterization Code View Commands enable users to specify the inputs they want to parameterize and the data source they want to drive the inputs from through data parameterization in the code view.
For example, the "ticker" query string parameter for "Page [4] Ticker List" in the above Tree View appear as http.querystring(http.param("ticker", "{{fmstocks_data.ticker,ter}}")
in the http.get
method code in the Code View, as follows (line breaks and spacing added for clarity):
beginStep("[4] Ticker List", 3422); { http.get(6, "http://testserver2/fmstocks/{{LINK_1_3,TickerList.asp}}", http.querystring(http.param("ticker", "{{fmstocks_data.ticker,ter}}"), http.param("company", "")), null, true, "ASCII", "ASCII"); } endStep()
Databanks are used to hold unlimited amounts of input data that can be automatically fed into your Web application. During playback, the parameters in the Web page are filled with values from the Databank file. The Databank and script parameter shortcut menu options allow you to map parameters in a script to fields in a Databank file as variable names.
Scripts must be configured to use Databanks. Use the Script Properties option on the Script menu to specify the Databank file(s) to use with a script in the Assets properties. Scripts can be configured to use more than one Databank file.
When you record a script that has a navigation that uses parameters, the parameter nodes appear under the Query String node:
In the Code View, the parameters appear in the http.param
parameters of the http.querystring
parameter:
When you configure the Databank(s) to use with the script, the Get next Databank record from databank name node and Java code are added to the script.
Select the script parameter node to map to a Databank and use the Substitute Variable option on the right-click shortcut menu to select the Databank field name to map to the parameter. The Databank file and field name appear in the parameter node of the script tree.
The variable appears in the Code view in the http.param
parameters of the http.querystring
parameter:
Use the Playback iterations to playback using the records in the Databank. You can also use custom code to loop through Databank records and assign values to variables.
You must configure the Databank to use with a script before you can get records from the Databank to use in a script.
To configure Databanks to use with a script:
Open or create a Script project.
Select Script Properties from the Script menu.
Select the Assets type.
Select Databanks.
Click Add.
Select the Repository from the My Repositories tree or file location from the My Computer tree.
Select the Databank file from the repository or file folder.
Enter an alias name to use for the Databank or leave the default alias name. The default alias name is the name of the .CSV Databank file.
Alias: Specifies an alias name to use for the Databank. The Databank file name is the default. The Databank alias name is the name that appears when you add a Databank record retrieval node to a script tree.
Click OK.
Click OK to add the Databank file.
Databank files are comma-separated value files. The field names are on the first line of the file separated by commas (no spaces). The field data is on subsequent lines separated by commas (different line for each record, no spaces around commas). The following shows an example:
FirstName,LastName,Mail,Phone
John,Smith,JohnS@company.com,x993
Mary,Ellen,MaryE@company.com,x742
If a data value contains a comma, place quotation marks around the value, as follows:
John,Smith,"Anytown, MA","(603) 993-0000"
To get Databank records to use with a script:
Open or create a script project.
Configure the Databank to use with a script in the Assets Script Properties.
Select the script node where you want to use the Databank record.
Select the Script menu and then select Other from the Add sub menu.
Expand the General node and select Get Next Databank Record.
Click OK.
Select the Databank alias to specify the Databank file to get the record from.
Click OK. A GetNextDatabankRecord: databank alias node will be added to the script.
In the Java Code view, the getDatabank("
databank alias
").getNextDataBankRecord()
method will be added to the script code:
getDatabank("customer").getNextDatabankRecord();
Right click the parameter node in the script tree that you want to substitute with a Databank variable and select Substitute Variable.
If necessary expand the Databanks node and select the Databank field you want to use as the input parameter data.
Click Finish.
The script node name/value pair changes to show the Databank alias name, field name, and recorded value as a variable value. For example:
login = {{db.customer,login,ta906}}
In the Java Code view, the parameter code changes to show the Databank alias name, field name, and recorded value as a variable value. For example:
http.postdata(http.param("login", "{{db.customer,login,ta906}}")
Click the Playback toolbar button to playback the script once to verify the it plays back correctly.