|
| 1 | +# Configuring UnitTestBot with auto-generated `settings.properties` |
| 2 | + |
| 3 | +Common users usually change UnitTestBot settings via UI: |
| 4 | +* in the **Generate Tests with UnitTestBot** dialog, |
| 5 | +* through **File** > **Settings** > **Tools** > **UnitTestBot**. |
| 6 | + |
| 7 | +Advanced users and contributors require advanced settings. |
| 8 | + |
| 9 | +## How to configure advanced settings: motivation to improve |
| 10 | + |
| 11 | +Advanced settings were not visible in UnitTestBot UI and were configurable only via `settings.properties`. |
| 12 | +UnitTestBot did not provide this file by default, so you had to create it manually in your `{home}/.utbot` directory. |
| 13 | +You could configure advanced settings here if you knew available options — they are listed in UnitTestBot source code, |
| 14 | +namely, `UtSettings.kt`. As UnitTestBot is a developing product, it often gets new features and new settings |
| 15 | +that UnitTestBot users sometimes are not aware of. |
| 16 | + |
| 17 | +## Implemented `settings.properties` improvements |
| 18 | + |
| 19 | +Currently, UnitTestBot generates a template `settings.properties` file with the up-to-date list of available setting |
| 20 | +options, corresponding default values, and explicit descriptions for each option. |
| 21 | + |
| 22 | +This template file is auto-generated on the basis of `UtSettings.kt` doc comments. It consists of |
| 23 | +the commented lines, so you can uncomment the line to enable the setting or easily get back to defaults. |
| 24 | + |
| 25 | +Generating `settings.properties` is a part of a Gradle task in IntelliJ IDEA. The `settings.properties` file is |
| 26 | +bundled with the published UnitTestBot plugin as a top-level entry inside the `utbot-intellij-{version}.jar` file. |
| 27 | + |
| 28 | +Upon IntelliJ IDEA start, the UnitTestBot plugin loads its settings and checks whether the template setting file exists |
| 29 | +in the local file system as `{home}/.utbot/settings.properties`: |
| 30 | +* If there is no such file, it is created (along with the hidden `{home}/.utbot` directory if needed). |
| 31 | +* An existing file is updated with new settings and corresponding info if necessary. |
| 32 | +* UnitTestBot does not re-write `settings.properties` if the file exists and has already been customized. |
0 commit comments