# Run, debug, and test Scala projects

> **TL;DR**
> Required plugin: Scala: [how to install](get-started-with-scala.html#scala_plugin)

IntelliJ IDEA lets you run, debug, and test your Scala applications as you would normally do with any other applications in IntelliJ IDEA. IntelliJ IDEA also lets you run your Scala code with coverage and configure code coverage settings.

> **Note:**
> To adjust configuration settings when you perform running or debugging processes, use the Run/Debug Configurations dialog. To access the dialog, select `Run | Edit Configurations` from the main menu.

## Run Scala applications

You can run your Scala code through IntelliJ IDEA, use sbt shell, or use [Scala worksheet](work-with-scala-worksheet-and-ammonite.html) for a quick code evaluation.

For a general overview of running programs in IntelliJ IDEA, refer to [Running Applications](running-applications.html).

Procedure: Run a Scala application via IntelliJ IDEA

1. Create or import a Scala project as you would normally [create or import](creating-and-managing-projects.html) any other project in IntelliJ IDEA.

2. Open your application in the editor.

3. Press `Shift+F10` (Windows), `⌃ R` (macOS), `⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ R` (macOS System Shortcuts), `Shift+F10` (XWin), `Shift+F10` (GNOME), `Shift+F10` (KDE), `Shift+F10` (Emacs), `Shift+F10` (Sublime Text), `Shift+F10` (Sublime Text (macOS)), `F6` (NetBeans), `Ctrl+F5` (Visual Studio), `⌃ F5` (Visual Studio (macOS)), `Alt+Shift+X` (Eclipse), `⌘ ⇧ F11` (Eclipse (macOS)) to execute the application. Alternatively, in the editor gutter, click the ![Run](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.run.run.svg) icon and select Run 'name'.

![Run main](https://resources.jetbrains.com/help/img/idea/2026.2/scala_run_app_editor.png)

Procedure: Run a Scala application using the sbt shell

You can run your application using the sbt shell that is a part of any [sbt project](sbt-support.html).

1. Open your sbt project.

2. If you want to delegate your builds and imports to sbt, in the sbt tool window, click the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.settings.svg) icon and select sbt Settings.

On the sbt settings page, under the sbt shell select the builds option (required sbt 0.13.5+) and click OK to save the changes.

![sbt settings](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_settings_for_running_sbt_shell.png)

This option is also available when you create or import an sbt project.

If you don't want to delegate your builds and imports to sbt, you can still work in the sbt shell (click sbt shell on the status bar) and [run sbt commands](https://www.scala-sbt.org/1.x/docs/Running.html) directly from it including running your application.

3. In the sbt projects tool window, click the sbt Tasks node.

4. In the list that opens, select the run task that will run a main method.

![sbt tool window: run task](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_tool_window_run_task.png) The result of execution is displayed in sbt shell tool window.

![sbt shell output](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_shell_run_app.png)

## Reload changes and hot swapping

Sometimes, you need to insert minor changes into your code without shutting down the process. Since the Java VM has a HotSwap feature, IntelliJ IDEA handles these cases for you. After you make a change in your code, a small popup appears. It offers a hot swap of the code, with the message: "You changed code during the debug session. You can apply these changes without restarting. All modified files will be recompiled and reloaded."

![Scala Hot Swap](https://resources.jetbrains.com/help/img/idea/2026.2/scala_hotswap.png)

## Alternative ways to run Scala code

For quick code evaluation, you can use a Scala worksheet that enables you to interactively run your code. Press `Ctrl+Alt+Shift+X` to create a light version of the Scala worksheet and `Ctrl+Alt+W` to run it. Alternatively, you can open Scala REPL and use it to import any class or module of your project and run its methods. For more information, refer to [Scala worksheet, Scala REPL and Ammonite](work-with-scala-worksheet-and-ammonite.html).

If your project is a ScalaCLI project, you can also start a ScalaCLI REPL from the terminal, import the project, and through this have access to all its classes, modules, and methods. You can learn more about ScalaCLI projects in IntelliJ IDEA at [Using ScalaCLI with IntelliJ IDEA](scalacli.html). In a similar way, if you use sbt, you can call `sbt console` from your terminal. In the screenshot below, we open sbt console for a project which contains a class called `Protagonist` and then create an instance of this class. For more information, refer to [sbt](sbt-support.html)

![sbt console](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_console.png)

If you need, you can also deploy your Scala application to a server. For more information, refer to [Working with Application
Servers](application-servers-support.html).

## Debug Scala code

IntelliJ IDEA lets you debug your code using IntelliJ IDEA debugger or the sbt shell.

For an overview of debugging in IntelliJ IDEA, refer to [Debugging](debugging-code.html).

Procedure: Debug Scala code using IntelliJ IDEA

1. Open your Scala application in the editor.

2. In the gutter, set your breakpoints for the lines of code you want to debug. For more information about breakpoints, refer to [Breakpoints](using-breakpoints.html).

3. If needed, you can access the Run/Debug configurations dialog (`Run | Edit Configurations`) and adjust the settings, but usually the default settings are enough to successfully run your debugging session.

4. Press `Shift+F9` (Windows), `⌃ D` (macOS), `⇧ F9` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ D` (macOS System Shortcuts), `Shift+F9` (XWin), `Shift+F9` (GNOME), `Shift+F9` (KDE), `Shift+F9` (Emacs), `Shift+F9` (Sublime Text), `⌃ D` (Sublime Text (macOS)), `Ctrl+F5` (NetBeans), `Alt+F5` (Visual Studio), `⌥ F5` (Visual Studio (macOS)), `Alt+Shift+D` (Eclipse), `⌘ F11` (Eclipse (macOS)).

Alternatively, on the project widget, click ![](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.run.debug.svg) icon to start debugging.

5. Evaluate the results in the Debug tool window.

For more information about using options in the Debug tool window, refer to the [Debug code](debugging-code.html) section.

You can adjust the default debugger settings and if you need, turn off the [smart step into](stepping-through-the-program.html#smart-step-into) feature which is enabled by default for the Scala code.

Procedure: Access the debugger settings

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Build, Execution, Deployment | Debugger`.

2. From the options on the right, you can edit the general debugger settings, or scroll down to the Scala section and adjust the Scala-specific debugger settings.

![the Debugger settings: Scala](https://resources.jetbrains.com/help/img/idea/2026.2/scala_debugger_settings.png)

If you need to disable  Smart step into for the Scala code, select `Debugger | Stepping` and disable the Always do smart step into option in the Scala section.

![the Stepping settings](https://resources.jetbrains.com/help/img/idea/2026.2/scala_smart_step_into.png)

Procedure: Debug Scala code using sbt shell

1. Open your sbt project.

2. Open your application in the editor.

3. In the editor gutter, set your breakpoints for the lines of code you want to debug.

![Set a breakpoint](https://resources.jetbrains.com/help/img/idea/2026.2/scala_code_breakpoints.png)

You cannot debug code defined in actual `.sbt` files, but you can debug code in Scala files that can be invoked from `build.sbt`.

> **Note:**
> If [forking](https://www.scala-sbt.org/1.x/docs/Forking.html) is enabled for the `run` or `test` tasks, debugging the tasks via the sbt shell will not work.

4. In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select `Build, Execution, Deployment | Build Tools | sbt`.

5. On the sbt page, select the Enable debugging and click OK to save the changes.

6. In the sbt shell tool window, click the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.run.debug.svg) icon to connect to the debugger server and start a debugging session.`

IntelliJ IDEA also creates a run/debug configuration for the debugging session.

![Run/Debug Configuration](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_run_debug_config_for_sbt_shell.png)

You can edit the run/debug configuration settings, but the default settings should be enough to successfully debug your code.

7. In the sbt shell enter the `run` command to run the program.

![sbt shell: run](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_shell_program.png)

Evaluate your results in the Debug tool window.

![Debug tool window](https://resources.jetbrains.com/help/img/idea/2026.2/sbt_debug_tool_window.png)

> **Tip:**
> If you want to rewind while debugging, you can do it via the Drop Frame action. This is particularly helpful if you mistakenly stepped too far. This will not revert the global state of your application, but will at least let you revert to the previous stack frame.

> **Tip:**
> Any breakpoint can be quickly disabled by clicking on the gutter while holding `Alt` (Windows), `Alt` (macOS), `Alt` (IntelliJ IDEA Classic (macOS)), `Alt` (macOS System Shortcuts), `Alt` (XWin), `Alt` (GNOME), `Alt` (KDE), `Alt` (Emacs), `Alt` (Sublime Text), `Alt` (Sublime Text (macOS)), `Alt` (NetBeans), `Alt` (Visual Studio), `Alt` (Visual Studio (macOS)), `Alt` (Eclipse), `Alt` (Eclipse (macOS)). To change breakpoint details, for example, conditions, press `Ctrl+Shift+F8` (Windows), `⌘ ⇧ F8` (macOS), `⌘ ⇧ F8` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F8` (macOS System Shortcuts), `Ctrl+Shift+F8` (XWin), `Ctrl+Shift+F8` (GNOME), `Ctrl+Shift+8` (KDE), `Ctrl+Shift+F8` (Emacs), `Ctrl+Shift+F8` (Sublime Text), `⌘ ⇧ F8` (Sublime Text (macOS)), `Ctrl+Shift+F8` (NetBeans), `Ctrl+Alt+B` (Visual Studio), `⌘ ⌥ B` (Visual Studio (macOS)), `Ctrl+Shift+F8` (Eclipse), `⌘ ⇧ F8` (Eclipse (macOS)).

## Shortcuts for running and debugging

The regular actions for run/debug are:

| Action | Shortcut |
| --- | --- |
| Run |  `Shift+F10` (Windows), `⌃ R` (macOS), `⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ R` (macOS System Shortcuts), `Shift+F10` (XWin), `Shift+F10` (GNOME), `Shift+F10` (KDE), `Shift+F10` (Emacs), `Shift+F10` (Sublime Text), `Shift+F10` (Sublime Text (macOS)), `F6` (NetBeans), `Ctrl+F5` (Visual Studio), `⌃ F5` (Visual Studio (macOS)), `Alt+Shift+X` (Eclipse), `⌘ ⇧ F11` (Eclipse (macOS))  |
| Debug |  `Shift+F9` (Windows), `⌃ D` (macOS), `⇧ F9` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ D` (macOS System Shortcuts), `Shift+F9` (XWin), `Shift+F9` (GNOME), `Shift+F9` (KDE), `Shift+F9` (Emacs), `Shift+F9` (Sublime Text), `⌃ D` (Sublime Text (macOS)), `Ctrl+F5` (NetBeans), `Alt+F5` (Visual Studio), `⌥ F5` (Visual Studio (macOS)), `Alt+Shift+D` (Eclipse), `⌘ F11` (Eclipse (macOS))  |

When in the debug mode, you can [evaluate any expression](examining-suspended-program.html#evaluating-expressions) by using the Evaluate expression tool `Alt+F8` (Windows), `⌥ F8` (macOS), `⌥ F8` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ L` (macOS System Shortcuts), `Alt+F8` (XWin), `Alt+Shift+8` (GNOME), `Alt+Shift+8` (KDE), `Alt+F8` (Emacs), `Alt+F8` (Sublime Text), `⌥ F8` (Sublime Text (macOS)), `Ctrl+F9` (NetBeans), `Shift+F9` (Visual Studio), `⇧ F9` (Visual Studio (macOS)), `Ctrl+U` (Eclipse), `⌘ U` (Eclipse (macOS)). This tool provides code completion in the same way as in the editor, so it's easy to enter any expression.

Sometimes, you may want to step into a particular method, but not the first one, which will be invoked. In this case, use Smart step into by pressing `Shift+F7` (Windows), `⇧ F7` (macOS), `⇧ F7` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ;` (macOS System Shortcuts), `Shift+F7` (XWin), `Shift+F7` (GNOME), `Shift+F7` (KDE), `Shift+F7` (Emacs), `Shift+F7` (Sublime Text), `⇧ F7` (Sublime Text (macOS)), `Shift+F7` (NetBeans), `Shift+F7` (Visual Studio), `⇧ F7` (Visual Studio (macOS)), `Ctrl+F5` (Eclipse), `⌥ F5` (Eclipse (macOS)) to choose a particular method.

| Action | Shortcut |
| --- | --- |
| Toggle breakpoint |  `Ctrl+F8` (Windows), `⌘ F8` (macOS), `⌘ F8` (IntelliJ IDEA Classic (macOS)), `⌃ Quote` (macOS System Shortcuts), `Ctrl+F8` (XWin), `Ctrl+F8` (GNOME), `Ctrl+8` (KDE), `Ctrl+F8` (Emacs), `Ctrl+F8` (Sublime Text), `⌘ F8` (Sublime Text (macOS)), `Ctrl+F8` (NetBeans), `F9` (Visual Studio), `F9` (Visual Studio (macOS)), `Ctrl+Shift+B` (Eclipse), `⌘ ⇧ B` (Eclipse (macOS))  |
| Step into |  `F7` (Windows), `F7` (macOS), `F7` (IntelliJ IDEA Classic (macOS)), `⌘ ;` (macOS System Shortcuts), `F7` (XWin), `F7` (GNOME), `F7` (KDE), `F7` (Emacs), `F7` (Sublime Text), `F7` (Sublime Text (macOS)), `F7` (NetBeans), `F11` (Visual Studio), `⌘ F11` (Visual Studio (macOS)), `F5` (Eclipse), `F5` (Eclipse (macOS))  |
| Smart step into |  `Shift+F7` (Windows), `⇧ F7` (macOS), `⇧ F7` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ;` (macOS System Shortcuts), `Shift+F7` (XWin), `Shift+F7` (GNOME), `Shift+F7` (KDE), `Shift+F7` (Emacs), `Shift+F7` (Sublime Text), `⇧ F7` (Sublime Text (macOS)), `Shift+F7` (NetBeans), `Shift+F7` (Visual Studio), `⇧ F7` (Visual Studio (macOS)), `Ctrl+F5` (Eclipse), `⌥ F5` (Eclipse (macOS))  |
| Step over |  `F8` (Windows), `F8` (macOS), `F8` (IntelliJ IDEA Classic (macOS)), `⌘ Quote` (macOS System Shortcuts), `F8` (XWin), `F8` (GNOME), `F8` (KDE), `F8` (Emacs), `F8` (Sublime Text), `F8` (Sublime Text (macOS)), `F8` (NetBeans), `F10` (Visual Studio), `F10` (Visual Studio (macOS)), `F6` (Eclipse), `F6` (Eclipse (macOS))  |
| Step out |  `Shift+F8` (Windows), `⇧ F8` (macOS), `⇧ F8` (IntelliJ IDEA Classic (macOS)), `⌘ \` (macOS System Shortcuts), `Shift+F8` (XWin), `Shift+F8` (GNOME), `Shift+F8` (KDE), `Shift+F8` (Emacs), `Shift+F8` (Sublime Text), `⇧ F8` (Sublime Text (macOS)), `Ctrl+F7` (NetBeans), `Shift+F11` (Visual Studio), `⇧ F11` (Visual Studio (macOS)), `F7` (Eclipse), `F7` (Eclipse (macOS))  |
| Resume |  `F9` (Windows), `⌘ ⌥ R` (macOS), `F9` (IntelliJ IDEA Classic (macOS)), `⌃ \` (macOS System Shortcuts), `F9` (XWin), `F9` (GNOME), `F9` (KDE), `F9` (Emacs), `F9` (Sublime Text), `F9` (Sublime Text (macOS)), `F5` (NetBeans), `F5` (Visual Studio), `F5` (Visual Studio (macOS)), `F8` (Eclipse), `F8` (Eclipse (macOS))  |
| Evaluate expression |  `Alt+F8` (Windows), `⌥ F8` (macOS), `⌥ F8` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ L` (macOS System Shortcuts), `Alt+F8` (XWin), `Alt+Shift+8` (GNOME), `Alt+Shift+8` (KDE), `Alt+F8` (Emacs), `Alt+F8` (Sublime Text), `⌥ F8` (Sublime Text (macOS)), `Ctrl+F9` (NetBeans), `Shift+F9` (Visual Studio), `⇧ F9` (Visual Studio (macOS)), `Ctrl+U` (Eclipse), `⌘ U` (Eclipse (macOS))  |

## Test Scala applications

IntelliJ IDEA with the Scala plugin lets you test your Scala applications using the following frameworks:

* [ScalaTest](https://www.scalatest.org/)

* [mUnit](https://scalameta.org/munit/)

* [Specs2](https://etorreborre.github.io/specs2/)

* [uTest](https://github.com/com-lihaoyi/utest)

* [JUnit](https://junit.org/)

* and [ZIO Test](https://zio.dev/reference/test/) through the [zio-test -runner](https://plugins.jetbrains.com/plugin/13820-zio-for-intellij/zio-test-runner) plugin.

For information on how to debug code in Scala tests, refer to [Debug code](debugging-code.html).

![Run test](https://resources.jetbrains.com/help/img/idea/2026.2/scala_test_code.png)

Procedure: How to test Scala applications

1. Open your project and configure dependencies:

* Assuming you use sbt as your build tool, open the `build.sbt` file and add a test dependency to `libraryDependencies` Click ![](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.general.refresh.svg) icon in the sbt projects tool window to refresh your project or use the Sync project after changes in the build scripts option specified in the [Build Tools](settings-build-tools.html) settings to automatically refresh your project each time you make changes to `build.sbt`.

* If you have a regular Scala project, use the Project Structure dialog, to configure test libraries.

2. Open a class for which you want to create a test and place the caret within the line containing the class declaration.

3. Press `Ctrl+Shift+T` (Windows), `⌘ ⇧ T` (macOS), `⌘ ⇧ T` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ T` (macOS System Shortcuts), `Ctrl+Shift+T` (XWin), `Ctrl+Shift+T` (GNOME), `Ctrl+Shift+T` (KDE), `Ctrl+Shift+T` (Emacs), `Ctrl+Shift+T` (Sublime Text), `Ctrl+Shift+T` (Sublime Text (macOS)), `Ctrl+Shift+T` (NetBeans), `Ctrl+Shift+T` (Visual Studio), `Ctrl+Shift+T` (Visual Studio (macOS)), `Ctrl+Shift+T` (Eclipse), `Ctrl+Shift+T` (Eclipse (macOS)) and select Create New Test.

Alternatively, to create a test suite, right-click the class and from the context menu select `Go to | Test`.

4. In the dialog that opens, specify your test settings and click OK.

5. Open the test in the editor, press `Ctrl+Shift+F10` (Windows), `⌃ ⇧ R` (macOS), `⌃ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ R` (macOS System Shortcuts), `Ctrl+Shift+F10` (XWin), `Ctrl+Shift+F10` (GNOME), `Ctrl+Shift+F10` (KDE), `Ctrl+Shift+F10` (Emacs), `Ctrl+Shift+F10` (Sublime Text), `Ctrl+Shift+F10` (Sublime Text (macOS)), `Alt+Shift+F6` (NetBeans), `Ctrl+Alt+F5` (Visual Studio), `⌃ ⌥ F5` (Visual Studio (macOS)), `Ctrl+Shift+F10` (Eclipse), `⌃ ⇧ R` (Eclipse (macOS)) or right-click the test class and from the context menu select Run 'test name'.

IntelliJ IDEA creates a run/debug configuration for the test automatically, but if you want to edit settings in your configuration, click `Run | Edit Configurations` from the main menu.

6. In the Run/Debug Configurations dialog, on the right side, specify settings for the test suite and click OK. The configuration has standard options, and you can find further details in the [Run tests](performing-tests.html) section.

You can also specify the following Scala-related options:

* You can select the Use sbt shell checkbox to run your test via sbt shell and the Use UI with sbt to display the test results in the same format as for platform test runner.

* You can select the Test kind option to specify what kind of test you want to run. For example, you can select Regular expression and set class and test patterns.

7. On the main toolbar, click the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.run.run.svg) icon to run the test.

8. Evaluate the results in the Run tool window.

> **Tip:**
> You can open the sbt shell, run your tests, and evaluate the results from the sbt shell using the `test` command.

> **Tip:**
> To create a new run/debug configuration for a test after opening the Run/Debug configurations dialog, click the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.add.svg) in the upper-left conner. From the list that opens, select one of the supported test frameworks: ScalaTest, mUnit, Specs2, etc.

> **Tip:**
> To edit the default templates for Scala test files, press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) and from the options on the left, select `Editor | File and Code Templates`. From the options on the right, select the `Code` tab and adjust your template.

## Test scopes in Scala

You can run tests inside a scope or test the whole scope in your Scala projects.

Create your test scope. For example:

```SCALA
import org.scalatest.GivenWhenThen
import org.scalatest.featurespec.AnyFeatureSpec

class StackFeatureSpec extends AnyFeatureSpec with GivenWhenThen {

    Feature("Feature 1") {
        Scenario("Scenario A") {
        }
        Scenario("Scenario B") {
        }

    }
    Feature("Feature 2") {
        Scenario("Scenario C") {
        }
    }
    Feature("empty") {
    }
}
```

In the editor, depending on your test scope, you can perform the following:

* If you open the context menu for one of the tests inside the scope, you can create a run configuration for the specified test inside that scope. ![Run/Debug Configuration: test in scope](https://resources.jetbrains.com/help/img/idea/2026.2/scalaTest_RunDebugConf_for_Test_in_Scope.png)

* If you open a context menu for the whole scope, you can create a run configuration for all tests inside the scope.

Run your tests and view the output in the Run tool window.

![Run tool window: tests passed](https://resources.jetbrains.com/help/img/idea/2026.2/scalaTes_console_RunTestInScope.png)

You can also use the [sbt shell](#run_sbt_scala_app) to run scope tests.

## Test Scala applications with coverage

IntelliJ IDEA lets you run your test suite with code coverage.

Procedure: Enable the Code Coverage for Java plugin

This functionality relies on the  Code Coverage for Java plugin, which  is bundled and enabled in IntelliJ IDEA   by default. If the relevant features are not available, make sure that you did not disable the plugin.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Installed tab, find the Code Coverage for Java plugin, and select the checkbox next to the plugin name.

Procedure: Run Scala tests with coverage

1. Make sure the Code Coverage for Java plugin is installed and enabled.

2. Open your project.

3. Open the test you want to run in the editor.

4. In the gutter, click ![](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.run.run.svg) and select the Run 'name' with Coverage option.

Alternatively, go to `Run | Run with Coverage` in the main menu to run your code with coverage.

IntelliJ IDEA runs the test and displays the Coverage tool window with code coverage information.

![Display Code Coverage](https://resources.jetbrains.com/help/img/idea/2026.2/scala_testcoverage_results.png)

Procedure: Configure coverage in a run configuration

You can adjust the default code coverage settings or code coverage behavior if you need.

If you have already run your test suite, IntelliJ IDEA creates a run/debug configuration automatically. You can open the created run configuration and adjust its settings. If you want to create a new run configuration for the test suite, do the following:

1. Make sure the Code Coverage for Java plugin is enabled.

2. In the main menu, go to `Run | Edit Configurations`.

3. In the Run/Debug Configurations dialog, click the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.add.svg) icon from the options on the left.

4. From the list that opens, select the configuration you need.

5. Open the Code Coverage tab. Adjust the default settings and click OK. For more information, refer to [Run configuration settings](code-coverage.html#run_configuration_settings).

![Configure Code Coverage](https://resources.jetbrains.com/help/img/idea/2026.2/scala_testcoverage_config.png)

Procedure: Configure coverage settings

You can also adjust code coverage behavior.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Build, Execution, Deployment | Coverage`.

2. Adjust the default settings and click OK. For more information, refer to [Project settings](code-coverage.html#project_settings).

