# Configuration file

Concordia Compiler can use a configuration file in [JSON format](https://en.wikipedia.org/wiki/JSON) named **`.concordiarc`**. You can generate it by running the following command:

```bash
npx concordia --init
```

You'll be asked about the desired configuration and then the file will be saved.

Example:

{% tabs %}
{% tab title=".concordiarc" %}

```javascript
{
    "language": "pt",
    "directory": "docs/features",
    "plugin": "codeceptjs-testcafe",
    "dirScript": "test/e2e",
    "dirResult": "test/e2e/output"
}
```

{% endtab %}
{% endtabs %}

Configuration file's properties are similar to CLI parameters. The example above defines: `"pt"` (meaning "Portuguese") as the default language; the directory `"docs/features"` for features and test cases; the plug-in `"codeceptjs-testcafe"` for generating test scripts; the directory `"test/e2e"` for test scripts; and the directory `"test/e2e/output"` for output files such as report files and screenshots.

{% hint style="warning" %}
CLI options take precedence over values from the configuration file
{% endhint %}

## File-related options

### `directory`

| Type   | Default value       | CLI option    |
| ------ | ------------------- | ------------- |
| string | `"."` (current dir) | `--directory` |

Directory to search for `.feature` and `.testcase` files.

Example:

```javascript
{
  "directory": "./features"
}
```

### `recursive`

| Type    | Default value | CLI option    |
| ------- | ------------- | ------------- |
| boolean | `true`        | `--recursive` |

Use recursive directory search.

Example:

```javascript
{
  "recursive": false
}
```

### `files`

| Type                   | Default value | CLI option |
| ---------------------- | ------------- | ---------- |
| string or string array | (none)        | `--files`  |

Files to consider, instead of considering `directory`. The files must be separated by colon.

Example:

```javascript
{
  "files": "/path/to/file1.feature,/other/file2.feature"
}
```

Another example:

```javascript
{
  "files": [
    "/path/to/file1.feature",
    "/other/file2.feature"
  ]
}
```

{% hint style="info" %}
We recommend you to configure the property `directory` whether your project can have new files.
{% endhint %}

### `ignore`

| Type                   | Default value | CLI option |
| ---------------------- | ------------- | ---------- |
| string or string array | (none)        | `--ignore` |

Files to ignore, considering the parameter `directory`. The files must be separated by colon. Example:

```javascript
{
  "ignore": [
    "/path/to/file1.feature",
    "/other/file2.feature"
  ]
}
```

### `extensions`

To-Do

### `encoding`

| Type   | Default value | CLI option   |
| ------ | ------------- | ------------ |
| string | `"utf8"`      | `--encoding` |

File encoding of the files. Accepted values are:

* `utf8` or `utf-8`
* `latin1`
* `ascii`
* `ucs2` or `ucs-2`
* `utf16le` or `utf-16le`

Naturally, the files must be edited with the given file encoding.

## Language-related options

To-Do

## Plug-in related options

To-Do

## Processing-related options

To-Do

## Generation-related options

To-Do

## Strategy-related options

To-Do

| Category   | Option                      | Data Type       | Default value         | Description                                                                                                                                                                                                                                                                                |                                                                                                                                                                                                                                                                                |
| ---------- | --------------------------- | --------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Files      |                             |                 |                       |                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `directory`                 | string          | none                  | Directory to search for specification and test case files                                                                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                |
|            | `recursive`                 | boolean         | `true`                | Recursive directory search                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                                                |
|            | `encoding`                  | string          | `"utf-8"`             | Default file encoding                                                                                                                                                                                                                                                                      |                                                                                                                                                                                                                                                                                |
|            | `extensions`                | array of string | `[ ".feature" ]`      | File extensions to search                                                                                                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                |
|            | `ignore`                    | array of string | `[]`                  | Files to ignore                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `files`                     | array of string | `[]`                  | Files to consider, instead of considering `directory`                                                                                                                                                                                                                                      |                                                                                                                                                                                                                                                                                |
| Language   |                             |                 |                       |                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `language`                  | string          | `"en"`                | Default specification language                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                |
| Plug-in    |                             |                 |                       |                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `plugin`                    | string          | none                  | Plug-in to use                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                |
| Processing |                             |                 |                       |                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `verbose`                   | boolean         | `false`               | Verbose output                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                |
|            | `compileSpecification`      | boolean         | `true`                | Whether it is desired to compile the specification                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                                |
|            | `generateTestCase`          | boolean         | `true`                | Whether it is desired to generate test case files                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                |
|            | `generateScript`            | boolean         | `true`                | Whether it is desired to generate test script files                                                                                                                                                                                                                                        |                                                                                                                                                                                                                                                                                |
|            | `executeScript`             | boolean         | `true`                | Whether it is desired to execute test script files                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                                |
|            | `analyzeResult`             | boolean         | `true`                | Whether it is desired to analyze test script results                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                                |
|            | `dirTestCase`               | string          | same as features'     | Output directory for test case files                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                                |
|            | `dirScript`                 | string          | `"./test"`            | Output directory for test script files                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                                                |
|            | `dirResult`                 | string          | `"./output"`          | Output directory of test script results                                                                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                |
|            | `lineBreaker`               | string          | OS' default           | Character(s) used to break lines in text files                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                |
| Generation |                             |                 |                       |                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `caseUi`                    | string          | `"camel"`             | String case used to identify UI Elements when their ids are not defined. Possible values are `"camel"`, `"pascal"`, `"snake"`, `"kebab"`, or `"none"`.                                                                                                                                     |                                                                                                                                                                                                                                                                                |
|            | `caseMethod`                | string          | `"snake"`             | String case used for test scripts' methods. Possible values are `"camel"`, `"pascal"`, `"snake"`, `"kebab"`, or `"none"`.                                                                                                                                                                  |                                                                                                                                                                                                                                                                                |
|            | `tcSuppressHeader`          | boolean         | `false`               | Whether it is desired to suppress header comments in test case files                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                                |
|            | `tcIndenter`                | string          | `"  "`                | Character(s) used as indenter for test case files                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                |
|            | `seed`                      | string          | current date and time | Randomic seed used by all the algorithms                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                |
|            | `randomMinStringSize`       | integer         | `0`                   | Minimum size for random strings                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `randomMaxStringSize`       | integer         | `500`                 | Maximum size for random strings                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `randomTriesToInvalidValue` | integer         | `5`                   | Tries to generate random values that are not in a set of values                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
| Strategies |                             |                 |                       |                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                |
|            | `combVariant`               | string          | `"random"`            | Algorithm to select and to combine the Variants with the state needed by a certain Variant. Options are: `"random"` to pick a random Variant, `"first"` to pick the first one, `"fmi"` to pick the first most important, or `"all"` to combine them all.                                   |                                                                                                                                                                                                                                                                                |
|            | `combState`                 | string          | `"sre"`               | Algorithm to select and to combine the Test Scenarios of every State of the selected Variants. Options are: `"sre"` to select a random Test Scenario of every State, `"sow"` to use the shuffled one-wise algorithm, `"ow"` to use the one-wise algorithm, or `"all"` to combine them all. |                                                                                                                                                                                                                                                                                |
|            | `combInvalid`               | string          | integer               | `"smart"`                                                                                                                                                                                                                                                                                  | Number of UI Elements that will receive invalid data test cases at a time, *e.g.* `1`. String options are `"none"` for no invalid values, `"smart"` to let the compiler decide, `"random"` to select a random number of UI Elements, `"all"` to select all the invalid values. |
|            | `combData`                  | string          | `"sow"`               | Algorithm to combine data test cases. Options are: `"sre"` to select a random data test case to combine, `"sow"` to use the shuffled one-wise algorithm, `"ow"` to use the one-wise algorithm, or `"all"` to combine them all.                                                             |                                                                                                                                                                                                                                                                                |
