This topic explains how to configure and apply the Data Generator tool, which stores data, such as numbers, strings, and dates into data sources or test suite variables for use in other tools. This tool is available in SOAtest and Virtualize.

  1. Right-click on a test suite, action suite, or responder associated with the data you want to extract and choose Add New> Test..., Add Output..., or Add New> Action (depending on whether you are using SOAtest or Virtualize).
  2. For SOAtest, click Standard Test and choose All Tools> Data Generator Tool. For Virtualize, choose Data Generator Tool in the tools panel of the Add Output wizard. If you are viewing tools by category, the Data Generator tool will be in the Data Exchange folder.
  3. Click Finish. An empty tool opens in the editor.
  4. Enter a name for the specific data set and click Add to open the data generator wizard.


     
  5. Choose a data type to generate and click Finish.


     
  6. You can specify a name for the specific instance of the Data Generator settings in the Name field. By default, the name of the generator type is used.
  7. Click on the Data Source Column tab to specify how data should be stored in the data source Column section:


     
    • Custom column name: Choose this option to specify the name of the data source column in which to store the value. Values are stored in an internal data source unless you specify otherwise (e.g., choosing Writable data source or Variable). This is the name you will use to reference the value in other places. If the value is stored in a data source column named My Value, for example, you would choose My Value as the parameterized value. You could also reference it as ${My Value} in literal or multiple response views.


       
    • Writable data source column: Choose this option to store the value in a writable data source column. This allows you to store an array of values. Other tools can then iterate over the stored values.
    • Write to all columns that match: Choose this option to store the value in all columns whose names contain the specified string. When extracting multiple values from a message, each value will be written across all the columns that match. In contrast, if you pick a single writable data source column, then the values will be written down the column across multiple rows.
    • Variable: Choose this option to save the value in the specified variable so that it can be reused across the current test suite. The variable must already be added to the current test suite as described in Defining Variables. Any values set in this manner will override any local variable values specified in the test suite properties panel.
  8. Click on the Configuration tab to specify how the values should be generated. See the following sections for specifics about how each generator creates different types of data:


    The following options are common to all data generators:
    • You can choose Fixed from the drop-down menu and enter a fixed value in the space provided.



    • Choose Parameterized from the drop-down menu to use parameterized values from the connected data source.
    • Choose Scripted and click Edit Script to open an editor if you want to programmatically configure the values.



      If you choose to script any of the configuration values, you choose a language from the drop-menu and enter the script into the text field. Click Evaluate to verify your script and click OK.
      You can also choose the File option in the script editor and point to an external script.


       
  9. When you’re finished configuring the tool, you can click Add to add additional data generators for your test suite or select a tool and click Remove to delete it.
  10. Click the save button when you’ve finished setting up your data generator(s).

Number Generator 

The number generator enables you to randomly generate numbers between a minimum and maximum value, as well as set the number of decimal spaces. Negative numbers are supported.

Defaults

When the minimum, maximum, and decimal place values are set to Fixed and left blank, the following defaults are used:

Minimum0
Maximum2147483647
Decimal places0

Additional Behaviors

The tool first generates a number that within the range specified in the Minimum and Maximum fields. Next, the number is rounded based on the number of decimal places specified.

You should enter a value in the Decimal places field equal to or greater than the largest number of decimal places specified in either the Maximum or Minimum values, otherwise the tool may generate a number outside the specified range when the number is rounded.

In the following example, the tool may generate a number outside the specified range:

Date/Time Generator

  1. Configure the start date in the Start Date section. 


    • Current date and time: Sets the start date and time to time of the test execution according to the local machine.
    • Current date at midnight: Sets the start date and time to midnight (00:00:00) using the output time zone. If the output time zone is blank, the local machine time zone will be used.
    • User defined: Choose this setting to configure a specific start date, format, time zone, and locale. You can use fixed values or programmatically configure the settings using parameterized values from the connected data source or a script.



      The start date and format are required when User defined is enabled. If these settings are configured to use fixed values, but the fields are blank the date/time will not be generated. The following examples show different ways to specify the start date and format:



  2. Configure the output settings in the Output section.


     
    The output settings can be fixed, parameterized, or scripted.
  3. Configure the tool to generate a past or future date in the Offset settings.


     
    You can specify how far off the generated date and time should be from the start date and time. You can use negative numbers to use past dates.

String Generator

The following fields are used to configure how strings are generated.

Pattern

This field defines the structure of the string.

The following special characters are used to define the pattern:

#This character is replaced with a number 0-9 when the tool runs.
&This character is replaced with a character as defined in the character map.
\Escapes the # and & characters, as well as other \ characters, so that they can be included in the generated string.

You can click the Pattern characters link to see this information in your IDE.

Character Map

This field specifies how characters map to the pattern characters. The default value when set to fixed is all printable ASCII characters, 0x20 (space) through 0x7e (~).

Example Usage

Using a fixed pattern set to ###-##-### and the default (empty) character map in fixed mode, you can generate social security numbers to use in your tests.

 

  • No labels