🖇️Dynamic Strings

Our automation tool is equipped with a robust system that allows for dynamic data handling based on the specified environment. This functionality ensures that the tool is flexible and can cater to various conditions such as development, testing, or production environments. Below is a detailed explanation of how this system works:

Environment-Specific Directories

Each environment, such as QA or sandbox, has a corresponding directory under the test_data folder. These directories contain property files which hold data pertinent to their respective environments. For example:

  • test_data/qa contains property files for the QA environment.

  • test_data/sandbox contains property files for the sandbox environment.

TestNgConfiguration Properties

The TestNgConfiguration.properties file is pivotal in determining which environment's data is to be utilized during test execution. It contains a key named ENV whose value is the name of the directory (environment) that the automation tool should reference. For example:

  • Setting ENV = qa in TestNgConfiguration.properties will instruct the tool to use data from the test_data/qa directory.

Dynamic Data Retrieval Process

When the automation suite is run, it reads the ENV property and dynamically selects the appropriate property files from the specified environment's directory. The data within these property files can be accessed using a unique syntax in the automation scripts:

  • $ denotes the start of a dynamic string.

  • text represents the name of the properties file (without the extension).

  • title is the key within the property file whose value you want to retrieve.

For example, $text.title will fetch the value associated with the key title from the text.properties file in the active environment directory.

Consistency Across Environments

To ensure the automation tool functions correctly, it is crucial that each environment directory contains property files with the same names. This consistency allows the tool to switch environments seamlessly without any changes to the automation scripts.

Use in SEND_KEYS and VALIDATION

This dynamic string substitution is not only limited to reading data; it is also applicable to operations like SEND_KEYS and VALIDATION. When a script is required to input or validate data, it can refer to these dynamic strings to get environment-specific values, thereby maintaining the flexibility and accuracy of test cases.

  • SEND_KEYS

  • VALIDATION

Last updated

Was this helpful?