Skip to content

clion install and configure

Olga Naumenko edited this page May 17, 2023 · 1 revision

Install and configure the UnitTestBot C/C++ plugin

Install the plugin

To install the plugin from the ZIP file:

  1. Download a ZIP archive with the release artifact. You can choose the release on GitHub. Unarchive this ZIP file.
  2. In your CLion, go to File > Settings.
  3. Select Plugins, click the gear icon and then Install Plugin from Disk.

  1. In the folder with the unarchived files from the release artifact, select the clion_plugin.zip file an and click OK.
  2. On Plugins, click OK to apply the changes and restart your IDE if prompted.

To check if the plugin is enabled, go to File > Settings > Plugins and choose Installed.

Open the project

Go to File > Open... and select the project to generate tests for.

Configure the plugin using UTBot: Quickstart wizard

The UnitTestBot C/C++ server and the client can be installed on the same or on different machines. WSL and Docker also behave differently: WSL automatically forwards the source paths to the server host, while Docker requires establishing an SSH connection.

Choose one of two paths in the wizard to start using UnitTestBot C/C++:

  • On the same machine or via WSL
  • On different machines or via Docker

To launch the UTBot Quickstart wizard, go to Navigate > Search Everywhere and enter UTBot Quickstart. Click on it.

You can also find the wizard in the Status Bar (lower right): select the UTBot widget and choose Quickstart wizard.

On the same machine or via WSL

If the UnitTestBot C/C++ server and the client are installed on the same machine, or the server is installed via WSL (without using Docker), make sure the Default server configuration on localhost (or WSL2) checkbox in the wizard is selected.

The default settings are:

  • Host: localhost
  • Port: 2121
  • Remote Path: autofilled
  • Build Directory: build
  • CMake options:
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
    -DCMAKE_EXPORT_LINK_COMMANDS=ON

Follow the default procedure — press Next until configuration is complete and proceed to generating tests.

On different machines or via Docker

If the UnitTestBot C/C++ server and the CLion plugin are installed on different machines, or the server is installed via Docker, you have to use the Deployment feature.

Configure an SFTP connection

Go to Settings > Build, Execution, Deployment > Deployment.

  • On the Connection tab, select the plus sign to create an SFTP connection (UTBot server):
    • For Type, choose SFTP.

  • For SSH configuration, select a browse button.

  • In SSH Configurations, enter your information:

    • Host: 127.0.0.1
    • Username: utbot
    • Port: 5522
    • Authentication type: OpenSSH config and authentication agent

  • For the Root path, select Autodetect (e.g., you get /home/utbot).

  • On the Mappings tab, specify the path to your project on the remote machine:

Upload the project to the remote server

In the Project tool window, right-click on your project root folder, select Deployment > Upload to... and choose the name of your SFTP configuration (e.g., UTBot server).

Perform the initial plugin setup

Launch the UTBot Quickstart wizard: go to Navigate > Search Everywhere and enter UTBot Quickstart. Click on it. Make sure the Default server configuration on localhost (or WSL2) checkbox is cleared.

The default settings are:

  • Host: 127.0.0.1
  • Port: 5521
  • Remote Path: /home/utbot/remote/c-example
  • Build Directory: build
  • CMake options:
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
    -DCMAKE_EXPORT_LINK_COMMANDS=ON

Follow the default procedure — press Next until configuration is complete.

The UnitTestBot C/C++ plugin builds and configures the project under test automatically — see notifications.

Clone this wiki locally