Skip to main content
Version: DAI 7.2

Using Parameters

This topic describes the types of parameters you can define when creating models. Parameters are placeholders that you could use to store values. They can be numbers, text, or values such as true or false. There are three types of parameters in Eggplant DAI that are described below: State parameters, Action parameters, and Global parameters.

State Parameters

State parameters can be used in a specific state as well as an action within a state. They can also be passed in and out of a snippets called by that state.

Configuring state parameters

To add a new state parameter, click New in the State Parameters section. You can also select then right-click the state in the Model workspace, then select New Parameter from the context menu. Then, configure state parameters by using the following selections:

  • Name: Enter an appropriate name for your parameter. You can use all Unicode characters but double quotes in this field.

  • Type: Enter the appropriate parameter type from the list menu:

    • Integer: This selection defines a parameter as a whole number (not a fraction) that can be positive, negative, or zero. Use the integer parameter type in models when, for instance, a count of something is important, such as the number of users or test cases.
    • True or False: Use this data type when your model requires a Boolean value such as on or off, true or false, and other similar values.
    • Real: The real data type includes rational numbers, such as 5, -5, and 2/3. It also includes irrational numbers, such as the square root of 2. Use a real data type for values such as for degrees, radians, or other similar information.
    • Text: Use this data type for storing a string or to define an allowable list of characters as a string. It can be any integer constraint, i.e., 2, 4, 8, 16 would make a string of either 2, 4, 8, or 16 characters long and much like other constraints, you can combine multiple constraints here. If you want to set a range of allowable characters, you must make them a range, e.g., 'a':'z' or a list "aeiou". Remember that the single and double quotes are important.
    • Set: This selection lets you define a set of allowed values for this parameter. Use this selection if you want Eggplant DAI to select a value from a specific list of values at runtime. For example: 'spring', 'summer', 'autumn', 'winter’. To input your list of values, right-click the parameter, select Edit Parameter Details from the context menu, then use the Values section of the Parameter Properties dialog box to set the values. You can use all Unicode characters but double quotes in this field.
    • Record: This selection lets Eggplant DAI read parameter values from records contained in a CSV file. To identify the directory containing the CSV file, go to Controller > Environments and find the execution environment that you're using. Click the actions menu and select Edit to see the directory path. When Eggplant DAI accesses the parameter, it selects one of the records from the CSV file and stores it in the parameter.
  • Generation: Enter the appropriate parameter generation method from the list menu:

    • Generated: Generates a new value for a parameter based on its parameter type.
    • Generated Unique: Generates a value but can't reuse a value that has been previously used.
    • Generated one-time: The generated value is selected once and then not selected again. The value remains static throughout the run.
    • Non-generated: The value is not generated and must be set to contain a value.
  • Initial Value: Set the initial value, if any, for this parameter. When using parameters of the type Record, the option you select in the Initial value field will determine the .csv file from where the records should be read from.

To edit an existing parameter, select it and update the information in the State Parameters section. To further customize parameters, right-click the parameter, then select Edit Parameter Details. The Parameter Properties dialog box lets you set an initial value as well as value ranges and other details.

To remove a parameter, right-click the parameter in the State Parameters section, then select Remove Parameter from the context menu.

Action Parameters

Action parameters capture and provide values for states and actions. To add a parameter to an action, right-click the action, then select New Parameter in the list menu. You can also select an action, then click New in Action Parameters, located in the right pane.

Using Action Parameters The Action Parameters section of the Action Properties tab

To set the conditions for generating a parameter, right-click the parameter, select Edit Parameter Details in the context menu, then use the Parameter properties dialog box to set the criteria.

Parameter properties dialog box

  • Name the parameter. You can use all Unicode characters but double quotes in this field.

  • Select a parameter Type:

    • Integer: This selection defines a parameter as a whole number (not a fraction) that can be positive, negative, or zero. Use the integer parameter type in models when, for instance, a count of something is important, such as the number of users or test cases.

    • True or False: Use this type when your model requires a Boolean value, such as on or off, true or false, or similar values.

    • Real: The real data type accepts positive and negative whole numbers and decimals. Use a real data type for values such as for degrees, radians, or other similar information.

    • Text: Use this data type to store a string. You can also use the Text data type to define an allowable list of characters as a string. You can use all Unicode characters but double quotes in this field.

    • Set: This selection lets you define a set of allowed values for this parameter. Use this selection if you want Eggplant DAI to select a value from a specific list of values at runtime. For example: 'spring', 'summer', 'autumn', 'winter’. To input your list of values, right-click the parameter, select Edit Parameter Details from the context menu, then use the Values section of the Parameter Properties dialog box to set the values. You can use all Unicode characters but double quotes in this field.

    • Record: This selection lets Eggplant DAI read parameter values from records contained in a CSV file. To identify the directory containing the CSV file, go to Controller > Environments and find the execution environment that you're using. Click the actions menu and select Edit to see the directory path. When Eggplant DAI accesses the parameter, it selects one of the records from the CSV file and stores it in the parameter.

      note

      When using data from a CSV file to pass values to a parameter, if a row of the CSV file contains four comma separated values (e.g., "spring, summer, autumn, winter"), then the whole row will be passed to the parameter. If you only require a specific value from the list, e.g., "autumn", then you must parse it using a snippet in Eggplant Studio.

  • Set the Initial value of the parameter. When using parameters of the type Record, the option you select in the Initial value field will determine the .csv file from where the records should be read from.

  • Set the Generation method you want Eggplant DAI to use:

    • Generated: Generates a new value for a parameter based on its parameter type.
    • Generated Unique: Generates a value but can't reuse a value that has been previously used.
    • Generated one-time: The generated value is selected once and then not selected again. The value remains static throughout the run.
    • Non-generated: The value is not generated and must be set to contain a value.
  • You can add Value groups to further define the parameters Eggplant DAI generates. Enter a value group as a value definition, using one definition per line.

    • Values: Enter the allowable values for this group entry. You can define parameter values as follows:

      • Enter a static value, such as 100.
      • Enter a range, such as 0:100.
      • Enter a list, such as 0, 2, 4, 6, 8.
    • Weight: Enter the relative weight you want Eggplant DAI to use when generating this parameter. For example, if you want Eggplant DAI to use this value group 50 percent of the time (as compared to the other value groups) when generating this parameter, enter 50 in this field.

    • Distribution: Select the statistical distribution method you want Eggplant DAI to use when generating this parameter:

      • Flat: Use a flat statistical distribution model.
      • Normal: Use a normal statistical distribution model.
      • Edge: Use statistical outliers.
    • Cov grps: Determines the number of segments Eggplant DAI uses to divide the values entries. Eggplant DAI begins with a value of 10 equal segments by default, then processes the values you enter for a value group and suggests a coverage group. For example, if you enter 0:360, as a value, Eggplant DAI might suggest 10 coverage groups that include 36 possible values for each coverage group to cover the value range from 0 to 360. You can manually enter a coverage group value that meets the needs for your model.

Global Parameters

Global parameters serve the same purpose as state and action parameters except they can be accessed from anywhere in the model. Global parameters are available to all states and actions in a model and not limited to a particular state or action. You can pass global parameters as an input for a snippet.

To add a new global parameter, follow these steps:

  1. In the Model workspace, click anywhere on the canvas without selecting any action or state.
  2. Either:
    • Right-click and from the context menu, select New Parameter.
    • On the Global Properties tab that is open on the right, in Global Parameters, click New.
  3. Enter the parameter Name, Type, Generation method, and Initial Value. The Initial Value field is only enabled for the Non-generated method.

You can edit and remove an existing global parameter in the same way as you would for a state or action parameter.

note

For Generated or Generated unique methods, the value is selected by the engine based on the rules in the parameter definition at the start of every Action/State execution in which it is defined before the snippet execution. If it is Generated one-time method, then it is only generated once, and that value remains for the rest of the model execution.