GoLand 2020.3 Help

Create tests

The simplest way of creating a new test file in GoLand is by using a dedicated shortcut that you can invoke from your source code. In this case, the IDE creates a new test file and generates test code for this file, package, or function.

Generate test files

  1. In the code editor, navigate to Code | Generate or press Alt+Insert.

  2. Select what kind of a test you want to generate and press Enter. You can create test files for the following scopes:

    • Empty test file

    • Test for function

    • Tests for file

    • Tests for package

    Generate test files

Navigate between test code and source code

In GoLand, you can jump between the test classes and the source code.

  • In the editor, place the caret at the test class or at the test subject in the source code and press Ctrl+Shift+T (Navigate | Test Subject or Navigate | Test).

If the IDE can't find the test file, it will prompt you to add it.

Jump to test
Last modified: 10 September 2020