- Responder or Action Suite
- Project
Global (requires validate license)
The higher the level of the data source, the more widely it can be shared. For instance, if you want to add a data source that is applicable only to a specific test, Responder, or Action suite, add it at the suite level. If you want to share it across suites in a project, add it at the project level. If you want to share it across multiple projects, add it at the global level.
Global and project level data sources can be reused and shared outside of a single project file. They are persisted in properties files that can be checked in/out of source control (if source control is used) for sharing. Global data sources are persisted in a separate properties file that the you can define in the preferences panel (under Preferences> Parasoft> Global Data Sources). Project level data sources are persisted in the .parasoft file in the Eclipse project directory.To add a data source
- Do one of the following:
- For a suite-level data source, select the desired suite node and click the Add Database toolbar button.
- For project level data sources, right-click the related project’s Test Case Explorer or Virtual Asset Explorer node, then choose Add New> Data Source.
- For global level data sources, right-click the Global Data Sources node, then choose Add New> Data Source.
- For a suite-level data source, select the desired suite node and click the Add Database toolbar button.
- Choose a data source type and click Finish. Click Next for the Bean Wizard. Once a data source is added, its configuration panel will be opened and it will be represented in the appropriate Data Sources branch. A node will be added for each available data source.
- Configure the data source as described below:
- Configuring a Repository Data Source
- Configuring a CSV File Data Source
- Configuring a Database Data Source
- Configuring an Excel Spreadsheet Data Source
- Configuring a Table Data Source
- Configuring an Aggregate Data Source that Combines Multiple Data Sources
- Configuring a Data Group Data Source that Lets You Switch Between Multiple Data Sources
- Configuring a File Data Source
- Configuring a Writable Data Source
Configuring a Repository Data Source
Parasoft’s Data Repository is designed to help teams define, extend, and review large and/or hierarchical data sets for use in Parasoft messaging tools. For details on configuring a repository data source, see Working with Large, Hierarchical Data Sets.
Configuring a CSV File Data Source
To configure a CSV file data source:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
Specify the path to the CSV file in the File Path field. You can use the following variables:
test_suite_loc: File path relative to the .tst or .pva file. For example:${test_suite_loc}/../files/myCSVFile.csv
project_loc: Relative path to a project. For example:${project_loc:MyProject}/myCSVFile.csv
You can also use environment variables.For example,${project_loc:MyProject}/DataSource/${virt_env:CVS_DIR}/my_csv_file.csv
. See Configuring Virtualize Environments.- Specify the type of separator and quotes that the file uses.
- Modify additional options if desired:
- Trim leading/trailing whitespace - Specifies whether or not to strip whitespace from the beginning and end of the value.
- First row specifies column names - Specifies whether or not to consider the first row of the CSV file as column names. If the first row specifies column names, the elements in Form XML will show the column names as the name of each value. If the first row does not specify column names, then the elements in Form XML will use "value" as the name of each value.
- If you want to see a list of the columns from that data source, click Show Columns. The first row of values are recognized as column titles. If you want to use different column titles, update the first row of your data source and click the Show Columns button.
Configuring a Database Data Source
You must specify the JDBC driver to connect to a database. See Configuring JDBC Drivers for details.
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use. You can enable the Range option and specify a specific range of rows (one-based index). For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field. All database rows are specified by default.
- Choose a driver class from the drop-down menu and configure the database connection settings. See Configuring JDBC Drivers for details on configuring connections for common database. Choose Custom if you do not see your driver class in the drop-down menu.
Click Show Columns if you want to check what column names are being used.
To use different column titles for the existing columns, update your database column names, then click the Show Columns button.
If you want to use different columns, update your SQL query so that it retrieve the appropriate columns, then click the Show Columns button.
Configuring an Excel Spreadsheet Data Source
To configure an Excel spreadsheet data source:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
Specify the path to the Excel file in the File Path field. You can use the following variables:
test_suite_loc: File path relative to the .tst or .pva file. For example:${test_suite_loc}/../files/myspreadsheet.xls
project_loc: Relative path to a project. For example:${project_loc:MyProject}/myspreadsheet.xls
You can also use environment variables.
For example,
${project_loc:MyProject}/DataSource/${virt_env:XLS_DIR}/myspreadsheet.xls
. See Configuring Virtualize Environments.- Select the sheet of the specified Excel file you would like to use from the Sheet menu.
- If you want SOAtest to limit the size of every column in the Excel data source to the size of the column with the least number of rows (in other words, if you want it to stop processing data when it encounters an empty cell), enable Stop processing the spreadsheet at the first empty row.
Important: SOAtest assumes that the first row of values represents your column titles. If they do not, you might have trouble identifying and selecting your data source columns in SOAtest. If you want SOAtest to use different column titles, update the first row of your data source, then click the Show Columns button.
Configuring a Table Data Source
To specify data source values by entering or pasting them into an internal table editor:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
- If you want to specify column names (rather than use the default A, B, C, D, etc.), check First row specifies column names.
- Add the data values by typing or pasting them into the table. You can copy from popular spreadsheets such as Excel. Note that the table editor contains standard copy/cut/paste editing commands (when a cell is selected) as well as commands to insert rows or tables. To add more rows, use the downward arrow key or the downward arrow scrollbar button. To add more columns, use the right arrow key or the right arrow scrollbar button.
Configuring an Aggregate Data Source that Combines Multiple Data Sources
You can create an aggregate data source in which you can combine the values of other available data sources into a single data source. This is especially useful if you would like to perform a functional test that needs to draw values from multiple data sources. For example, in sending a request to a server, you may want to send values from a data source that contains user information such as a first and last name, and you may also want to send values from a separate data source that contains the user’s login and password information. By combining the two data sources into a single aggregate data source, you can create a single test instead of having to create separate tests for each data source.
For a discussion of how aggregate data sources compare to data groups, see Understanding Data Groups and Aggregate Data Source.To combine multiple data sources into an aggregate data source:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
- Choose the desired data sources from the Available box and click the Add button to add them to the Selected box.
- The Available box contains all of the data sources added to the test suite. After selecting and adding the desired data sources to the Selected box, the column names contained in the added data sources display in the Columns box.
Configuring a Data Group Data Source that Lets You Switch Between Multiple Data Sources
A data group can include a number of similar data sources that have at least one column in common; it allows you to select which data group should be applied at any given time. This is especially useful if you want to dynamically specify different data sources for the same tool. You can quickly switch which data source is used at runtime without having to edit tools or data sources. To use data groups, you group together data sources with shared columns and then specify which data source should be active.
For a discussion of how data groups compare to aggregate data sources, see Understanding Data Groups and Aggregate Data Source.To combine multiple data sources into a data group:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
- Choose the desired data sources from the Available box and click the Add button to add them to the Selected box.
- The Available box contains all of the data sources added to the test suite.
- If a data source does not have any columns in common with the currently selected data sources, it cannot be added.
- If adding a data source will reduce the number of shared columns across data source, a warning will be displayed.
- After you select and add the desired data sources to the Selected box, the common columns that occur in all the selected data sources will be shown in the Columns box.
Under Active Data Source, specify which data source you want to be active. If you want to specify the active data source "on the fly" at runtime, you can configure the Active Data Source field with an environment variable using the
${var_name}
notation, then specify the desired environment at runtime (from the command line interface or the UI—see Configuring Virtualize Environments for details).
Configuring a File Data Source
To configure a File data source:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
- Specify the file or directory to import files from. All of the files available in the specified location will display in the table. Right-click options allow you to cut, copy, and paste values in as well.
- To filter which files are used by the File Data Source, enter a string in the File Filter field. For example:
- * = wild card for any string
- *.* = all files (this is the default)
- *.txt = all text files
- data* = all files whose files names begin with "data"
- data*.txt = all text files whose files names begin with "data"
- *data* = all files whose file names contain the string "data" somewhere
- To filter which files are used by the File Data Source, enter a string in the File Filter field. For example:
- Enable the Refresh Dynamically Based on Last Import option if you want the file data source to use all files that are in the import directory at the time the file data source is used. If you do not enable this option, the file data source will only use the files that are listed in the table in the file data source—even if the import directory has additional files. This option must be enabled in the following cases to ensure the portability of the .tst file:
- When the .tst file needs to be executed on multiple machines.
- When the .tst file will be used in a load test that uses multiple Load Test generator machines.
At runtime, the contents of each file is used as a data source value.
Configuring a Writable Data Source
To configure a writable data source that captures runtime data for reuse in subsequent tests:
- (Optional) Change the data source label in the Name field of the Data Source configuration options.
- Use the Rows controls to indicate the range of rows you want to use.
- If you only want to use selected rows, click the Range button, then enter the desired range (assuming a one-based index) by typing values into the From and To fields. For example, to use only the first 10 rows, enter 1 in the From field and 10 in the To field. To use only the fifth row, enter 5 in the From field and 5 in the To field.
- Specify your preferred writing mode for writing to the data source. You can choose one of the following options:
- Set-Up test mode> Append: Choose this option if you want set-up tests to append new data after any previously written values. This is the default mode. Only set-up tests can write to the data source in this mode.
- Standard test mode> Overwrite: Choose this option if you want standard tests (non set-up tests) to overwrite any previously written values with new data. Only standard tests can write to the data source in this mode.
- Standard test mode> Append: Choose this option if you want standard tests (non set-up tests) to append new data after any previously written values. Only standard tests can write to the data source in this mode. If you enable this option, you can also specify the Reset frequency setting, which determines how the data source will reset (i.e., clear) any previously-written data.
- Per iteration: Configures the data source to reset each time the test suite in which it lives begins to iterate over a new data source row.
Per write access: Configures the data source to reset before each new write access (appending data in a single write access only).
- If you want to specify column names (rather than use the default A, B, C, D, etc.), check First row specifies column names.
- Set up population for the Writable data source (e.g., by having tool a data bank tool write to it).
For example, one way to populate the Writable data source is:
- Add a XML Data Bank tool as a tool output.
- Exercise the suite to populate the XML Data Bank.
- Add a node to the Selected XPaths in the XML Data Bank GUI.
- Double-click the entry row underneath the Data Source column name column in the XML Data Bank GUI. A Modify dialog displays.
- Select Data source column on the left, then select Writable data source column on the right and specify the name of the column you want to contain the stored value.
Note