Running Automated Tests
Adding test automation to your build pipelines supports continuous integration, and allows you to implement and test new features as early as possible.
In Eggplant DAI, you can trigger a set of tests, or test configuration, from the command line. To do this, you need to download, install, and run the DAI CLI tool or any of the provided pipeline plugins for Azure, Github, or Jenkins as described below.
-
Download the DAI CLI tool for your platform. The following platforms are supported:
- Windows 10/11/ and Server 2019/2022
- macOS: 11 and above
- Linux: RHEL 8, Ubuntu 16 and Ubuntu 22
Plugins for Azure, Github, and Jenkins are available in their respective market stores. You can find instructions for installing and configuring them at the links below.
-
Run your test configuration with the CLI tool or plugin executable file from the command line. See Run test config by Id or Run test config by Name for more information.
The executable
runs until the test config is complete.
- If the test config runs successfully, it will complete with an exit code of
0
. - Other exit codes indicate that the test config has failed.
Run Test Configuration by Test Config Id
When creating a test configuration, each test configuration will be assigned a unique identifier (TEST_CONFIG_ID
).
To retrieve this ID, go to Controller > Test Config and edit the test configuration that you want to run. The TEST_CONFIG_ID
value is appended to the URL.
.
Other mandatory options:
Parameter | Value Description |
---|---|
SERVER_URL | URL for the Eggplant DAI server. For example: https://myeggplantserver.com |
TEST_CONFIG_ID | Test config ID. For example: adcb4d6e-3b3e-4cc3-a62b-3bba84fe5ab0 . It is the string appended to the DAI URL when you open a test config. See image above. |
--client-id <CLIENT_ID> --client-secret <CLIENT_SECRET> | Retrieve the client secret pair set up during installation. For security, you might want to set the DAI_CLIENT_SECRET environment variable instead of passing your credentials on the command line. |
For the cli --help
to see all parameters and options, run this command:
eggplant-runner-Windows-7.4.0-4.exe --help
At your command line, run the following command:
eggplant-runner-Windows-7.4.0-4.exe <SERVER_URL> <TEST_CONFIG_ID> --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
eggplant-runner-Windows-7.4.0-4.exe https://myeggplantserver.com adcb4d6e-3b3e-4cc3-a62b-3bba84fe5ab0 --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
For more configuration settings, see advanced options.
Run Test Configuration by Test Config Name
Alternatively, you can also run a test configuration by using the test config name configured in DAI server, along with its model name or suite name. You can find this information from Controller > Test Config.
Other mandatory options:
Parameter | Value Description |
---|---|
SERVER_URL | URL for the Eggplant DAI server. For example: https://myeggplantserver.com |
--client-id <CLIENT_ID> --client-secret <CLIENT_SECRET> | Retrieve the client secret pair set up during installation. For security, you might want to set the DAI_CLIENT_SECRET environment variable instead of passing your credentials on the command line. |
Model based Test Configuration
To run a model-based test configuration, retrieve the values for following options from your test configuration:
Parameter | Value Description |
---|---|
SERVER_URL | URL for the Eggplant DAI server. For example: https://myeggplantserver.com |
--client-id <CLIENT_ID> --client-secret <CLIENT_SECRET> | Retrieve the client secret pair set up during installation. For security, you might want to set the DAI_CLIENT_SECRET environment variable instead of passing your credentials on the command line. |
At your command line, run the following command:
eggplant-runner-Windows-7.4.0-4.exe modelbased <SERVER_URL> --test-config-name=<TEST_CONFIG_NAME> --model-name=<MODEL_NAME> --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
Script based Test Configuration
To run a script-based test configuration, retrieve the values for following options from your test configuration:
Parameter | Value Description |
---|---|
--test-config-name <TEST_CONFIG_NAME> | DAI test configuration name that you want to run. |
--suite-name <SUITE_NAME> | DAI suite name for the specified test configuration. Full suite name including .suite at the end. For example: --suite-name=EggApplication.suite |
For the cli --help
to see all parameters and options for script-based, run this command:
eggplant-runner-Windows-7.4.0-4.exe scriptbased --help
At your command line, run the following command:
eggplant-runner-Windows-7.4.0-4.exe scriptbased <SERVER_URL> --test-config-name=<TEST_CONFIG_NAME> --suite-name=<SUITE_NAME> --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
eggplant-runner-Windows-7.4.0-4.exe scriptbased https://myeggplantserver.com --test-config-name=TestConfigEggplantApp --suite-name=EggApplication.suite --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
For more configuration settings, see advanced options.
Advanced Options
Advanced options are optional but do allow you to fine-tune test executions. For an up-to-date list, run the --help
option. See advanced examples, for CLI examples.
Option | Description |
---|---|
--request-timeout INTEGER | Timeout in seconds for each HTTP request to the DAI server. Default: 30 |
--request-retries INTEGER | Number of times to attempt each HTTP request to the DAI server. Default: 5 |
--backoff-factor FLOAT | Exponential backoff factor between each HTTP request. Default: 0.5 |
--log-level TEXT | Logging level. Default: INFO |
--ca-cert-path PATH | Path to an alternative Certificate Author pem file |
--test-result-path PATH | Path to a file where the test results will be stored in junit xml format |
--version | Shows the version number and exits |
--dry run / --no-dry-run | Perform a dry run only. Default: no-dry-run |
--param TEXT | The test config global parameter you want to override in the format parameter_name=parameter_value . For example: --param username=Lily or --param "textEntry=\"Text entry with spaces and special symbols!\"" .Instead of passing individual parameters, we recommend that you put the parameters in a JSON file and specify its location using one parameter: the --param-file PATH described below. |
--param-file PATH | The path to a user-created JSON file that contains the global parameters you want to override. The keys in the file are the names of the global parameters you want to override, and their values are the values you want to use instead. Both parameter names and values must be of type string. |
--poll-interval INTEGER
& --test-environment-timeout INTEGER
are Deprecated in DAI 7.4. Please refer to Retries the connection for SUT and Execution Environments for the variable settings you should use instead.
Advanced Examples
The following DAI CLI examples show how you can use advanced options:
--log-level TRACE
eggplant-runner-Windows-7.4.0-4.exe scriptbased https://myeggplantserver.com --test-config-name=TestConfigEggplantApp --suite-name=EggApplication.suite --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET> --log-level=TRACE
--test-result-path PATH
-runner-Windows-7.4.0-4.exe scriptbased https://myeggplantserver.com --test-config-name=TestConfigEggplantApp --suite-name=EggApplication.suite --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET> --test-result-path="c:\EggplantResults\ResultEggplantAppJunit.xml"
--param TEXT
eggplant-runner-Windows-7.4.0-4.exe scriptbased https://myeggplantserver.com --test-config-name=TestConfigEggplantApp --suite-name=EggApplication.suite --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET> --param MyEnvironment=Production --param username=Eggy
--param-file PATH
Example of a parameter json file
{
"MyEnvironment": "Production",
"username": "Eggy@eggplant.com"
}
eggplant-runner-Windows-7.4.0-4.exe scriptbased https://myeggplantserver.com --test-config-name=TestConfigEggplantApp --suite-name=EggApplication.suite --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET> --param-file="c:\EggplantCLI\TestConfigParameter.json"