IntelliJ IDEA 2022.2 Help

Using the Testify toolkit

Programming is not always a straightforward process. Especially, when you need to add a small piece of code to an application and ensure that the whole application works as intended. In this case, testing can help you to maintain code quality and improve its reliability.

IntelliJ IDEA supports the Testify toolkit. Testify provides several packages to work with assertions, mock objects, and testing suites. With Testify, you can run your suites and methods as regular test functions. For more information about the toolkit, read the description of Testify on GitHub.

Run tests with Testify

  1. Run go get -u github.com/stretchr/testify in the terminal. Alternatively, use the intention action Alt+Enter to download and install the toolkit.

  2. Click the Run test icon The Run test icon and select Run <configuration>.

Run tests with Testify

Compare expected and actual values

You can compare expected and actual values for failed assertion tests.

  • To see the difference, click the Click to see difference link in the Run pane.

    Compare expected and actual values
Last modified: 29 November 2022