Am using testify's test suite support to write unit tests. This results in my test file having a single TestFooBar(t *testing.T)
that kicks of the suite.Run
while all my individual tests become a part of my test suite struct
with method signatures like - func (suite *myTestSuite) TestMyStuff()
.
I have observed that GoLand can identify all methods with a signature similar to TestFooBar(t *testing.T)
and put a green play icon next to it. It will allow me to run/debug these methods individually. However, all the test methods that are a part of the test suite as described above, won't be identified and cannot be ran or debugged individually in the IDE.
Any way to tell GoLand that myTestSuite
structure has many tests that will allow me to execute them individually inside the IDE?
(Similar question here but that is just talking about command line, while my question is specifically for the IDE.)
At the moment, the IDE does not support recognizing tests from testify. There's an issue for that, https://youtrack.jetbrains.com/issue/GO-3066, and we hope we'll get it done soon.
As a workaround, you can edit manually a Run Configuration via Run | Edit Configurations... | + | Go Test and pass the arguments to the Go Tool in order to pick up the test that you need to debug.
Workaround: Remove the suite receiver, do the test and then put the suite receiver back.