メインコンテンツまでスキップ
バージョン: DAI 25.1

Working with Custom Scripts in DAI

Eggplant DAI provides the capability to upload custom shell scripts, such as shell scripts (.sh) and batch files (.bat), allowing you to assign them to test configs for execution. This feature allows you to switch branches at runtime, depending on the version or environment of the target application, providing flexibility in testing across different application versions or environments.

ノート

The Custom Scripts feature is disabled by default. As with any command-line level execution capability, security is an important consideration. For information about enabling the Custom Scripts feature, see the Custom Scripts page. For general information about how you can secure your DAI setup, see Securing You DAI Installation.

To start using this feature, you need to:

  1. Enable Custom Scripts
  2. Add a custom script
  3. Assign the custom script to test config
  4. Run the test config

Additionally, you can edit, set as default or delete an existing custom script.

Enable Custom Scripts

Enabling the Custom Script feature for a Windows on-prem deployment involves editing the DAI configuration file (config.yml) as described in the steps below.

Important

For DAI container deployments (Helm and Garden) or other production environments, please contact our Customer Support team to enable this feature.

  1. Stop the Digital Automation Intelligence Service through the Windows Services Manager.

  2. Go to C:\ProgramData\Eggplant\Digital Automation Intelligence and open the config.yml file in a text editing tool.

  3. Add the ENABLE_CUSTOM_SCRIPTSfeature flag under the env key as shown below. Note your config.ymnl file may contain other entries under the env: key.

    config.yml
    env:
    CUSTOM_SCRIPTS_ENABLED: 1 <Custom Scripts are enabled>
  4. Save the config.yml file.

  5. Restart the Digital Automation Intelligence service in the Windows Services Manager to apply the config changes.

  6. Restart the Digital Automation Intelligence Windows service.

Add a Custom Script

You must add a custom script in DAI before you can assign it to a test config.

To add a custom script, follow these steps:

  1. Log in to Eggplant DAI.

  2. Go to System > Custom Scripts. The Custom Scripts page opens, displaying any existing scripts, or it shows no scripts if none have been added yet.

  3. Click + New custom script.

    Add Custom Script Page

  4. In the Name box, enter a unique name for the custom script. Script names are limited to 100 characters and cannot contain the following characters: , \ ; : " ' { }.

  5. In the Script file, select a file to import. You can either click the Browse files button to search for the file or drag and drop it directly from your computer folders.

    ノート
    • The supported file types for import are batch (.bat) and shell (.sh). Ensure the file is formatted correctly for its file type.

    • Ensure the file size does not exceed 1000 bytes (1 kilobyte).

    • Only upload one file at a time.

    Extra Information for Ubuntu

    • An issue with the drag and drop from the desktop to a browser exists in Ubuntu 20.04.6 LTS. To resolve this, you need to install the Desktop Icons NG (DING) extension from GNOME Extensions.

    • This issue does not occur in Ubuntu 24.04.1 LTS, as drag and drop from the desktop to the browser works without the need for any additional extensions.

  6. For the Set as default custom script option, enable the Use this custom script by default for test configs toggle (set it to on) if you want this script to be the default custom script for all your test configs. This option is disabled by default.

    ノート
    • The custom script will be executed on the first run for all test configs in the runner when it is set as the default.

    • If the custom script is not set as the default, it can be assigned to specific test configs via their settings.

    • Only one custom script can be assigned and executed for a test config. If a test config has a custom script assigned and the default option is enabled, the runner will execute the assigned script instead of the default.

  7. Click Save.

Assign a Custom Script to a Test Config

You can assign a custom script to a specific test config by navigating to the Advanced Settings tab of the test config.

If a custom script is set as the default, it will automatically be assigned to all test configs. However, you can still assign a specific custom script to a test config, overriding the default setting.

Run a Test Config

You can run a test configuration in the Runner by navigating to Controller > Runner and clicking the Run button for the test configuration you want to run.

The custom script will be executed first, prior to running the main test script.

Custom Script Test Config Run

Edit a Custom Script

To edit an existing custom script, click the custom script name in the Name column or select Edit from the row menu.

Edit Custom Script

You can modify various details, such as the script name, the script file, or toggle the button to set or unset the default custom script. After making the necessary changes, click Save to apply the updates to the custom script.

Additionally, you will see the Used in Test Configs section, which displays:

  1. When the custom script is set as the default.

    Default Custom Script Card

  2. When the custom script is not assigned to any test configs.

    Custom Script Not Assigned Card

  3. When the custom script is assigned to one or more test configs.

    Custom Script Assigned Test Config Table

Set a Custom Script as the Default

There are two ways to set an existing custom script as the default custom script for all test configs:

  1. Select Set as default from the row menu.

    Set Custom Script As Default

  2. Toggle the button to On in the Set as Default field in the edit page.

Important

Setting a new custom script as default will override the previous default custom script. As a result, all test configs will run the newly set default custom script.

Delete a Custom Script

There are two ways to delete an existing custom script:

  1. Select Delete from the row menu.

    Delete Custom Script

  2. Click Delete on the Custom script settings page.

    Delete Custom Script Edit Page

A confirmation dialog box appears, asking you to confirm the deletion. Click Delete to proceed.

Delete Custom Script Confirmation Modal

Important

Deleting a custom script removes the script from all test configs and reverts the test configs to use a default script when one is specified. This action cannot be undone.