# Test

All automated tests live in this directory.
Before running tests, ensure that you have completed the setup steps in the main [README.md](../README.md), including installing all prerequisites and dependencies.

## Getting Started
1. **Clone the repository**
   ```bash
   git clone https://github.com/IBM/continuous-delivery-tools.git
   cd continuous-delivery-tools
   ```
2. **Install dependencies**
    ```bash
    npm install
    ```
3. **Test configuration**

    Before running tests, create a local configuration file:
    ```bash
    cp test/config/local.template.json test/config/local.json
    ```
    Then open `test/config/local.json` and replace all placeholder values with your local or test environment settings.
4. **Running the tests**
    
    To execute the test suite:
    ```bash
    npm run test
    ```

### Test Configuration
You can customize the behavior of the tests by defining configuration properties in the `test/config/local.json` file.

| Property           | Type      | Default           | Description                                                                                                                  |
| ------------------ | --------- | ------------------| ---------------------------------------------------------------------------------------------------------------------------- |
| `TEST_DEBUG_MODE`  | `boolean` | `false`           | When set to `true`, files generated by test cases in `TEST_TEMP_DIR` and log files generated in `TEST_LOG_DIR` are preserved |
| `TEST_TEMP_DIR`    | `string`  | `test/.tmp`       | The directory to store temporary files generated by test cases                                                               |
| `TEST_LOG_DIR`     | `string`  | `test/.test-logs` | The directory to store test run log files                                                                                    |
| `IBMCLOUD_API_KEY` | `string`  | `null`            | The IBM Cloud API Key used to run the tests                                                                                  |
| `LOG_DUMP`         | `boolean` | `false`           | When set to `true`, individual test case's process's log file generation is enabled, and logs are written to `TEST_TEMP_DIR` |
| `DISABLE_SPINNER`  | `boolean` | `true`            | When set to `true`, visual spinner is disabled across all test cases' processes                                              |
| `VERBOSE_MODE`     | `boolean` | `false`           | When set to `true`, each test case's log output increases                                                                    |
