Using the Testify toolkit
Last modified: 10 August 2022Programming 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
Run
go get -u github.com/stretchr/testify
in the terminal. Alternatively, use the intention action Alt+Enter to download and install the toolkit.Click the Run test icon
and select Run <configuration>.

note
Ensure that the test file has the _test postfix (for example, testify_test.go).
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.
Thanks for your feedback!