# Run tests

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/go/2026.3/llms.txt).

> **TL;DR**
> Run the selected test or test folder: `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)), `Ctrl+Shift+F10` (VSCode), `Ctrl+Shift+F10` (VSCode (macOS))
>
>
>
> Stop the current test session: `Ctrl+F2` (Windows), `⌘ F2` (macOS), `⌘ F2` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ .` (macOS System Shortcuts), `Ctrl+F2` (XWin), `Ctrl+F2` (GNOME), `Ctrl+2` (KDE), `Ctrl+F2` (Emacs), `Ctrl+F2` (Sublime Text), `Ctrl+F2` (Sublime Text (macOS)), `Shift+F5` (VSCode), `⇧ F5` (VSCode (macOS))

Procedure: Run tests directly in a file or folder

If your tests do not require any specific actions before start, and you do not want to configure additional options,  you can run them by using the following options:

* Place the caret at the test file to run all tests in that file, or at the test function, and 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)), `Ctrl+Shift+F10` (VSCode), `Ctrl+Shift+F10` (VSCode (macOS)). Alternatively, click the ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.run.run.svg) gutter icon next to the  test function and select Run '<test name>' from the list.

The gutter icon changes depending on the state of your test:

* The ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.actions.runAll.svg) gutter icon marks a set of tests. Use this icon to run all the tests in the file.

* The ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.run.run.svg) gutter icon marks new tests.

* The ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.gutter.runSuccess.svg) gutter icon marks successful tests.

* The ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.gutter.runError.svg) gutter icon marks failed tests.

* To run all tests in a folder, select this folder in the Project tool window and 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)), `Ctrl+Shift+F10` (VSCode), `Ctrl+Shift+F10` (VSCode (macOS)) or select Run Tests in 'folder' from the context menu.

![Running a test using the gutter icon](https://resources.jetbrains.com/help/img/idea/2026.3/go_run_test.png)

Procedure: Run tests using the Run widget

When you run a test, GoLand creates a temporary run configuration. You can save temporary run configurations, change their settings, share them with other members of your team. For more information, refer to [Run/debug configurations](run-debug-configuration.html).

1. Create a new [run configuration](run-debug-configuration.html) or save a temporary one.

2. Use the Run widget on the main toolbar to select the configuration you want to run.

3. Click ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.run.run.svg) or 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)), `Ctrl+F5` (VSCode), `⌃ F5` (VSCode (macOS)).

![Running a run/debug configuration for tests](https://resources.jetbrains.com/help/img/idea/2026.3/go_run_run_config_tests.png)

Procedure: Run tests from Structure

In the [Structure tool window](viewing-structure-of-a-source-file.html#structure-tool-window), you can select one or several test methods to run. In this case, the IDE also creates a temporary run configuration with these methods that you can [save](run-debug-configuration.html#save-as-permanent) and edit.

1. In the Project tool window, double-click the Go test file (`_test.go`).

2. Navigate to `View | Tool Windows | Structure`.

3. In the Structure tool window, right-click one or several test methods and select ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.gutter.run.svg) Run 'method name' (`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)), `Ctrl+Shift+F10` (VSCode), `Ctrl+Shift+F10` (VSCode (macOS))).

4. Right-click a method in the Structure tool window and select:

* Add to temp suite: <Configuration_name> if there is only one configuration with the Pattern test scope.

* Add to JUnit Pattern Suite (JUnit) / Add to Temp Suite (TestNG) if there are several configurations with the Pattern test scope. In this case, a popup appears in which you can select the target configuration.

![Save a temporary test configuration](https://resources.jetbrains.com/help/img/idea/2026.3/go_run_test_from_structure_save_rc.png)

Procedure: Run tests from the Commit tool window

If you made changes to your test classes and want to run them before committing, you can do it from the [Commit](commit-and-push-changes.html#commit) tool window. You can choose whether to run a single test class, multiple classes, or all uncommitted test classes under a directory, module, or changelist.

1. Go to the Commit tool window (`Alt+0` (Windows), `⌘ 0` (macOS), `⌘ 0` (IntelliJ IDEA Classic (macOS)), `⌘ 0` (macOS System Shortcuts), `Alt+0` (XWin), `Alt+0` (GNOME), `Alt+0` (KDE), `Alt+0` (Emacs), `Alt+0` (Sublime Text), `⌘ 0` (Sublime Text (macOS)), `Alt+0` (VSCode), `⌘ 0` (VSCode (macOS))).

2. Right-click a test class, directory, module, or changelist, and select ![Run icon](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.run.run.svg) Run '<Test Class Name>'.

> **Tip:**
> To select multiple items, hold `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (VSCode), `Ctrl` (VSCode (macOS)) while clicking each item.

![Run action in the context menu of the Commit tool window](https://resources.jetbrains.com/help/img/idea/2026.3/run-test-from-commit-tw.png)

As a result, GoLand creates and launches a temporary run configuration for your test selection. If you want to rerun the same tests in the future, you can [save this
configuration](run-debug-configuration.html#save-as-permanent) in the run widget and then [customize
its settings](list-of-run-debug-configurations.html).

> **Tip:**
> To preserve the tab of a run configuration, even if you execute another run configuration, [you may pin it](run-tool-window.html#pin_tabs).

After GoLand finishes running your tests, it shows the results in the Run tool window on the tab for that run configuration. For more information about analyzing test results, refer to [Explore test results](viewing-and-exploring-test-results.html).

![Running all tests in a folder, stopping, and rerunning a single test](https://resources.jetbrains.com/help/img/idea/2026.3/go_run_test_results.png)

Procedure: Run tests with test flags

Use Go tool arguments to configure the test build and program arguments to configure the test run. For available flags, refer to [the Go command documentation](https://pkg.go.dev/cmd/go).

1. Navigate to `Run | Edit Configurations`.

2. Select your Go Test run/debug configuration.

3. To enable data race detection, enter `-race` in Go tool arguments. For supported platforms and requirements, refer to the [Go race detector documentation](https://go.dev/doc/articles/race_detector).

4. In Program arguments, enter test-binary flags with the `-test.` prefix:

* `-test.failfast`: stops starting new tests after the first test failure.

* `-test.short`: enables short mode. Tests can check `testing.Short()` to skip or reduce long-running work.

* `-test.benchmem`: prints memory allocation statistics for benchmarks.

Procedure: Run tests in a package or directory

1. In the main menu, select `Run | Edit Configurations`.

2. Click the Add New Configuration icon (![Add New Configuration](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.add.svg)) and select Go Test.

3. From the Test kind drop-down list, select one of the following options:

* Package: to run all tests for the selected package in the Package path field.

* Directory: to run tests in the directory specified in the Directory field and its subdirectories. To test all packages in a module, select the directory that contains its `go.mod` file.

4. Click Run.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/go_run_all_tests_in_a_project.mp4)

## Fuzz testing

Fuzz testing requires Go 1.18 or later.

Fuzz testing is a way to automate your tests by continuously submitting various input. The input is generated according to the sample data that you provided in `f.Add("mySampleData")`.

The `f.Add()` method accepts the following data types: `string`, `[]byte`, `rune`, `int`, `int8`, `int16`, `int32`, `int64`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `float32`, `float64`, `bool`.

Procedure: Run fuzz tests

* Click the gutter Run Test icon, select Run, and then select the fuzz testing configuration (for example, go test -fuzz FuzzTest).

If the testing fails, you can click the link to the `testdata` directory to see what input has failed the test.

To run go test with the failing seed corpus entry, open the file from the `testdata` directory, click the Run Fuzzing icon in the gutter, and select the necessary configuration.

![Running fuzz testing](https://resources.jetbrains.com/help/img/idea/2026.3/go_running_fuzz_testing.png)

Procedure: Debug fuzz tests

1. Create a breakpoint by clicking the gutter on the necessary line.

Alternatively, click the line where you want to create a breakpoint and press `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)), `F9` (VSCode), `F9` (VSCode (macOS)).

2. Click `Run | Debug`.

3. In the Debug popup window, select the run/debug configuration.

> **Note:**
> You cannot debug fuzz tests with configurations that have the Directory test kind. Use File or Package test kinds instead.

## Run tests after commit

When you want to check that your changes would not break the code before pushing them, you can do that by running tests as commit checks.

> **Note:**
> This feature is only available for [Git](using-git-integration.html) and [Mercurial](using-mercurial-integration.html).

Procedure: Set up test configuration

1. Press `Alt+0` (Windows), `⌘ 0` (macOS), `⌘ 0` (IntelliJ IDEA Classic (macOS)), `⌘ 0` (macOS System Shortcuts), `Alt+0` (XWin), `Alt+0` (GNOME), `Alt+0` (KDE), `Alt+0` (Emacs), `Alt+0` (Sublime Text), `⌘ 0` (Sublime Text (macOS)), `Alt+0` (VSCode), `⌘ 0` (VSCode (macOS)) to open the Commit tool window and click Show Commit Options ![the Settings button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg).

2. Under the Advanced Commit Checks menu, next to the Run Configuration option, click  Choose configuration  and select which configuration  you want to run.

![Pre-commit checks menu](https://resources.jetbrains.com/help/img/idea/2026.3/go_VCS_advanced_commit_options.png)

After you have set up the test configuration, the specified tests will run every time you make a commit.

## Stop tests

Procedure:

Use the following options on the Run toolbar of the tab for the run configuration:

* Click ![the Stop button](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.run.stop.svg) or press `Ctrl+F2` (Windows), `⌘ F2` (macOS), `⌘ F2` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ .` (macOS System Shortcuts), `Ctrl+F2` (XWin), `Ctrl+F2` (GNOME), `Ctrl+2` (KDE), `Ctrl+F2` (Emacs), `Ctrl+F2` (Sublime Text), `Ctrl+F2` (Sublime Text (macOS)), `Shift+F5` (VSCode), `⇧ F5` (VSCode (macOS)) to terminate the process immediately.

![Stop running tests](https://resources.jetbrains.com/help/img/idea/2026.3/go_stop_running_tests.png)

## Rerun tests

Procedure: Rerun a single test

* Right-click a test on the tab for the run configuration in the Run tool window and select Run 'test name'.

Procedure: Rerun all tests in a session

* Click ![the Rerun button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.run.rerun.svg) on the Run toolbar or press `Ctrl+F5` (Windows), `⌘ R` (macOS), `⌃ F5` (IntelliJ IDEA Classic (macOS)), `⌘ R` (macOS System Shortcuts), `Ctrl+F5` (XWin), `Ctrl+F5` (GNOME), `Ctrl+5` (KDE), `Ctrl+F5` (Emacs), `Ctrl+F5` (Sublime Text), `⌘ R` (Sublime Text (macOS)), `Ctrl+F5` (VSCode), `⌘ R` (VSCode (macOS)) to rerun all tests in a session.

Procedure: Rerun failed tests

You can rerun and debug  tests that failed in your last test run without having to rerun the tests that passed.

* To rerun failed tests, go to the Run tool window's toolbar and click ![Rerun Failed Tests icon](https://resources.jetbrains.com/help/img/idea/2026.3/intellij.platform.ide.expui.run.restartFailedTests.svg) Rerun Failed Tests.

* Hold `Shift` (Windows), `Shift` (macOS), `Shift` (IntelliJ IDEA Classic (macOS)), `Shift` (macOS System Shortcuts), `Shift` (XWin), `Shift` (GNOME), `Shift` (KDE), `Shift` (Emacs), `Shift` (Sublime Text), `Shift` (Sublime Text (macOS)), `Shift` (VSCode), `Shift` (VSCode (macOS)) and click ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.run.restartFailedTests.svg) to choose whether you want to Run the failed tests again or Debug  them.

For Go tests, GoLand also includes interrupted tests and tests that did not start, if they appear in the test results. Tests marked as skipped are excluded from the rerun selection.

Procedure: Rerun tests automatically

In GoLand, you can enable the autotest-like runner: any test in the current run configuration restarts automatically after you change the related source code.

* Click ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.actions.rerunAutomatically.svg) Rerun Automatically on the test results toolbar to enable the autotest-like runner.

## Debug failed tests

If you do not know why a test fails, you can debug it.

Procedure:

1. In the editor, click the gutter on the line where you want to set a   breakpoint .

There are different types of breakpoints that you can use depending on where you want to suspend the program. For more information, refer to [Breakpoints](using-breakpoints.html).

2. Right-click the ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.gutter.runError.svg) gutter icon next to the failed test and select Debug 'test name'.

The test will rerun in debug mode. After that, the test will be suspended, allowing you to [examine its current state](examining-suspended-program.html).

You can [step through the test](stepping-through-the-program.html) to analyze its execution in detail.

![Debugging a test using the gutter icon](https://resources.jetbrains.com/help/img/idea/2026.3/go_debug_test.png)

## Productivity tips

Procedure: Run individual table tests

* You can run individual table tests by using the Run icon (![the Run icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.execute.svg)) in the gutter. Also, you can navigate to an individual table test from the Run tool window.

Current support of table tests has following limitations:

* The test data variable must be a slice, an array, or a map. It must be defined in the same function as the `t.Run` call and must not be used after initialization (except for the `range` clause in the `for` loop).

* The individual test data entry must be a struct literal. Loop variables used in a subtest name expression must not be used before the `t.Run` call.

* A subtest name expression can be test data string field, a concatenation of test data string fields, or a `fmt.Sprintf()` call with `%s` and `%d` verbs. For example, in the following code snippet, `fmt.Sprintf("%s in %s", tc.gmt, tc.loc)` is a subtest name expression. ```GO for _, tc := range testCases { t.Run(fmt.Sprintf("%s in %s", tc.gmt, tc.loc), func(t *testing.T) { loc, err := time.LoadLocation(tc.loc) if err != nil { t.Fatal("could not load location") } gmt, _ := time.Parse("15:04", tc.gmt) if got := gmt.In(loc).Format("15:04"); got != tc.want { t.Errorf("got %s; want %s", got, tc.want) } }) } ```

![Run individual table tests](https://resources.jetbrains.com/help/img/idea/2026.3/go_run_individual_table_tests.png)

## See also

### Reference

[Run tool window](run-tool-window.html)

