stretchr / testify

A toolkit with common assertions and mocks that plays nicely with the standard library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go test -run does not work for a particular test

eginez opened this issue · comments

I have a test suite made of a couple of test, I'd like to run only one test with go test -run regex but go test is not finding the test

you need to use -testify.m to specify your test:
go test -run TestYourTestSuiteMethod -testify.m TestYourIndividualMethod
TestYourTestSuiteMethod is the method where it calls suite.Run(t, new(YourTestSuite))

ahh thanks!

That didn't work for me (also the docs mention -m and not -testify.m; but never mind).

Looks like the testify flag is being ignored.

Just for the record: it works, but the order of the flags is relevant.

It did work for me like this:

go test -run TestYourTestSuiteMethod ./package -testify.m TestYourIndividualMethod

If I don't specify the package, go test won't find any package when the -testify.m flag is processed.

close this issue? @eginez

Is there a way to make goland recognize the individual test methods in a suite as well, so they can be run individually from inside the IDE using the green play button?