Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions clion-plugin/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Configuration

## Remote Scenario

If you run UTBot and CLion on different hosts, synchronization of project files is required:

- If UTBot is run inside the Docker container, mount your project folder to Docker.
- If UTBot is run under WSL, no additional configuration required, just
specify remote path to your project in `Settings` or use `Quickstart Wizard` to
fill it for you.
- If server is not run locally, CLion deployment can be used for synchronization, although it won't be
fully automated, look at information below:

### Configuring CLion SFTP deployment for remote scenario

To configure SFTP do the following:

- Open `Settings -> Build, Execution, Deployment -> Deployment`
- Create SFTP configuration: click `+` and choose or create SSH config with server host and port, than
specify the path to your project on the remote machine in mappings, it is the same path you have specified
in `Settings` for remote path
- Go to `Options` and turn on upload on change:

![](images/plugin_usage/sftp/sftp-config.gif)

- Go to `Project view` and right-click on your project root, then
choose `Deployment`, click `Upload to ...` and choose the name of your
SFTP configuration:

![](images/plugin_usage/sftp/upload.gif)

Now server can access your project files.

When you change your files, CLion should upload changes to server.

## Local scenario

Wizard allows you to configure your project quickly without specifying different options manually in
`Settings`. When you open your project for the first time, UTBot Wizard will be shown.

![](images/plugin_usage/wizard/wizard-welcome.png)

### Connection

After the first introductory step, you will be asked to
fill several settings: server port, server host and remote path.
Remote path specifies path to project on remote machine.

If UTBot is run on WSL or Linux (on the local machine), be sure
to check the checkbox that fills in default values for the path and the port.

![](images/plugin_usage/wizard/wizard-connection.png)

### Build Directory and CMake Options

On the final Wizard step, UTBot will ask you to:
- specify relative path to the build directory
- set custom CMake options

![](images/plugin_usage/wizard/wizard-build-options.png)

### Demo

A demo how to go through the wizard:

![](images/plugin_usage/wizard/wizard-demo.gif)

## Plugin settings

The recommended way to configure plugin is to use UTBot Wizard.

If some advanced settings are required, specify them in `Settings -> Tools -> UTBot Settings`

![](images/plugin_usage/settings-demo.gif)

### Remote path

Remote path is a path to your project on the remote host. If UTBot is run locally, leave it empty.


## Check configuration

When the connection to server is established, you can check project configuration
to make sure that all path are specified correctly: just invoke `Configure project` action:

![](images/check-config/check-not.gif)

When project is configured, `Project is configured` notification appears:

![](images/check-config/check-ok.gif)

When plugin is configured and configuration is checked, you can start using plugin to generate tests.
For further details how to use plugin see `USAGE.md`.
48 changes: 5 additions & 43 deletions clion-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,13 @@ Plugin to communicate with [UTBotCpp](https://github.com/UnitTestBot/UTBotCpp) s

### Installation

1. Clone UTBotCpp into selected folder, select it in the command line and run:
```
cd clion-plugin
./gradlew assembleDist
```
2. Open CLion and go to `settings -> plugins`
3. Click `Install Plugin from Disk...`:
1. Open CLion. Go to `Settings -> plugins`
2. Uninstall the previous version of plugin. Skip this step if you install it for the first time
3. Click on `Settings` icon and then choose `Install from disk`
![](images/install/install-from-disk.png)
4. Navigate to plugin folder `clion-plugin`, go to `build/distributions`
and choose `zip` file:
![](images/install/choose-zip.png)
4. Choose plugin's zip file: `clion_plugin.zip`
5. Restart CLion

### Configuration

#### Using quickstart wizard
When the plugin is opened for the first time, a quickstart wizard appears.

![](images/plugin_usage/wizard.png)

You can open it manually any time: click on `connection status` and choose
`Show Quickstart Wizard` action.

![](images/plugin_usage/show_wizard.png)

or press `shift` twice and find this action:


![](images/plugin_usage/find-wizard-action.png)

#### Using settings

You can also configure plugin using settings. All options can be set manually.

1. Open plugin settings in `settings` - `Tools` - `UTBot Settings`
2. Click `detect paths`. It tries to get source paths and build directories paths from CLion
cmake model.
3. Specify an absolute path to the build directory, it should be different from the build directory that CLion uses,
because conflicts between UTBotCpp and CLion may occur. For example, if CLion uses `project_path/cmake-build-debug`,
you can specify `project_path/utbot_build`.
4. For target path specify `/utbot/auto/target/path`
5. Specify a path to test folder.
6. Specify a name of the server and port.
7. If you use docker to run UTBotCpp and your project is mounted to docker,
you can specify path to project inside docker.

See `CONFIGURATION.md` to configure the plugin before use.

<!-- Plugin description end -->
65 changes: 35 additions & 30 deletions clion-plugin/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,59 @@

# How to use plugin

### Check connection status
You must be connected to server to use plugin. \
Connection status can be checked in the status bar.
### Status bar icons

![](images/plugin_usage/connectionStatus.png)
Before you start working with UTBot, it is worth to pay attention to the status bar in IDE
and UTBot-specific controls there:

### Configure project and generate json files
<img src="images/plugin_usage/statusbar/status-bar-icons.png" alt="drawing" height="25"/>

Your project must be configured by server to generate tests.
#### Connection status

To send request for project configuration or json files generation,
click on `connection status` in the status bar and choose a suitable option:
Connection status indicates whether the client and the server have established a connection.
If the connection is lost, you'll see

![](images/plugin_usage/generateJson.png)
<img src="images/plugin_usage/statusbar/not-connected.png" alt="drawing" height="25"/>

Plugin sends request for project configuration when you open
the project. Sometimes configuration fails, then after changing
your project you need to send the request for project configuration.
In such case you need to check if UTBot Docker container is still running.

### Choose source folders
Clicking on the connection status icon, you see the list of actions can be invoked:

To generate tests for project, server needs to know the folders source files are located in.
The source folders are marked with green icons in the project view:
<img src="images/plugin_usage/statusbar/status-bar-actions.png" alt="drawing" height="100"/>

![](images/plugin_usage/source-folders.png)
#### Verbose mode

You can mark/unmark selected folders from context menu.
You can change the verbose option from status bar.

![](images/plugin_usage/mark-unmark-folders.gif)
If verbose mode is enabled or disabled, it is represented as follows:

### How to request tests generation
<img src="images/plugin_usage/statusbar/verbose-on.png" alt="drawing" height="23"/>

Open a c/cpp file, right click in the text editor and
choose suitable option in the context menu:
<img src="images/plugin_usage/statusbar/verbose-off.png" alt="drawing" height="23"/>

![editor actions](images/plugin_usage/editorActions.png)
### Plugin description

For example, to generate tests for the folder, right click on it in the project view
and choose `Generate for folder`:
Main UI elements of the plugin are:
- Status bar icons, they show connection status and verbose mode option
- `UTBot consoles`, a window to show logs from server (GTest log, Server log) and plugin (Client log)
- `UTBot targets`, a window to show targets found by server in current project
- `UTBot Source Directories`, a view to show source directories marked green

![project view actions](images/plugin_usage/projectViewActions.png)
![](images/plugin_usage/overview.png)

### See logs from server and client
#### Generate tests

You can see messages that are sent to the server and server own logging messages. Just click on the `UTBot consoles` tab in the bottom right corner:
You can trigger tests generation from:

![UTBot consoles tab](images/plugin_usage/consolesTab.png)
- Context menu in editor:

add choose the required tab:
<img src="images/plugin_usage/generate/editor-gen.png" alt="drawing"/>

- Context menu in project view:

<img src="images/plugin_usage/generate/project-view-gen.png" alt="drawing" height="300"/>

- Search window: pressing `Shift` two times and searching for action

<img src="images/plugin_usage/generate/gen-search.png" alt="drawing" height="300"/>

![UTBot consoles view](images/plugin_usage/consolesToolWindow.png)
Binary file added clion-plugin/images/check-config/check-not.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clion-plugin/images/check-config/check-ok.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed clion-plugin/images/plugin_usage/consolesTab.png
Binary file not shown.
Binary file not shown.
Binary file removed clion-plugin/images/plugin_usage/editorActions.png
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed clion-plugin/images/plugin_usage/generateJson.png
Binary file not shown.
Binary file not shown.
Binary file added clion-plugin/images/plugin_usage/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed clion-plugin/images/plugin_usage/settings.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clion-plugin/images/plugin_usage/sftp/upload.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed clion-plugin/images/plugin_usage/show_wizard.png
Binary file not shown.
Binary file removed clion-plugin/images/plugin_usage/source-folders.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed clion-plugin/images/plugin_usage/wizard.png
Diff not rendered.