IntelliJ Platform Plugin SDK Help

IntelliJ Platform Testing Extension

The IntelliJ Platform Gradle Plugin introduces a top-level intellijPlatformExtension extension. It provides a possibility for registering custom tasks for running the IDE, unit tests, UI tests, or performance tests.

For each of the custom tasks, a dedicated sandbox is created to isolate them form other tasks or the build flow as they may rely on a different IntelliJ Platform version, plugins, or other configuration.

IntelliJ Platform Testing

After the IntelliJ Platform Gradle Plugin is applied, the intellijPlatformTesting extension can be used for registering new tasks to fulfil specific requirements of the project.

The extension exposes four NamedDomainObjectContainers which allow for creating new objects of given types. Registering of a custom task which allows for adjusting the IntelliJ Platform type and version can be done by using one of the below containers, depending on the task purpose.

Example:

intellijPlatformTesting { runIde testIde testIdeUi testIdePerformance }
intellijPlatformTesting { runIde testIde testIdeUi testIdePerformance }

By default, created tasks depend on the IntelliJ Platform defined with Dependencies Extension. However, it is possible to adjust it to any requirements with passing custom values directly to the created object, task, or sandboxTask task instances.

Example:

val runPhpStorm by intellijPlatformTesting.runIde.registering { type = IntelliJPlatformType.PhpStorm version = ... useInstaller = ... localPath = ... sandboxDirectory = ... splitMode = ... splitModeTarget = ... task { ... } prepareSandboxTask { ... } plugins { ... } }
intellijPlatformTesting.runIde { runPhpStorm { type = IntelliJPlatformType.PhpStorm version = ... useInstaller = ... localPath = ... sandboxDirectory = ... splitMode = ... splitModeTarget = ... task { ... } prepareSandboxTask { ... } plugins { ... } } }

task {}

Depending on the type of registered object, a different task class is available for configuration:

Type

Task class

runIde

RunIdeTask

testIde

TestIdeTask

testIdeUi

TestIdeUiTask

testIdePerformance

TestIdePerformanceTask

prepareSandboxTask {}

The prepareSandboxTask refers to a dedicated PrepareSandboxTask task instance, connected only with a newly created task. The name of this task is based on the name of created task, like prepareSandbox_[TASK_NAME].

plugins {}

An extension to provide custom plugins to be added when running the task runtime, or disabling bundled ones.

It provides several methods for adding remote and local plugins, or for disabling already loaded or bundled plugin.

Example:

val runIdeWithPlugins by intellijPlatformTesting.runIde.registering { // ... plugins { plugin("pluginId", "1.0.0") disablePlugin("pluginId") } }
intellijPlatformTesting.runIde { runIdeWithPlugins { // ... plugins { plugin("pluginId", "1.0.0") disablePlugin("pluginId") } } }

Function

Description

plugin(id, version, channel)

Adds a dependency on a plugin for a custom IntelliJ Platform.

plugin(notation)

Adds a dependency on a plugin for a custom IntelliJ Platform using a string notation:

pluginId:version or pluginId:version@channel

plugins(notations)

Adds dependencies on plugins for a custom IntelliJ Platform using a string notation:

pluginId:version or pluginId:version@channel

disablePlugin(id)

Disables the specific plugin with its ID.

disablePlugins(ids)

Disables specific plugins with the list of their IDs.

localPlugin(path)

Adds a dependency on a local IntelliJ Platform plugin. Accepts path or a dependency on another module.

robotServerPlugin(version)

Adds a dependency on a Robot Server Plugin.

Last modified: 16 August 2024