Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go test -run does not work for a particular test #460

Closed
eginez opened this issue Jun 7, 2017 · 7 comments
Closed

go test -run does not work for a particular test #460

eginez opened this issue Jun 7, 2017 · 7 comments

Comments

@eginez
Copy link

eginez commented Jun 7, 2017

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

@yiminc-zz
Copy link
Contributor

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))

@eginez
Copy link
Author

eginez commented Jun 9, 2017

ahh thanks!

@reidrac
Copy link

reidrac commented Oct 3, 2017

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.

@reidrac
Copy link

reidrac commented Oct 5, 2017

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.

@timfeirg
Copy link
Contributor

close this issue? @eginez

@amitsaurav
Copy link

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?

@alecbz
Copy link

alecbz commented Jan 16, 2020

@amitsaurav https://blog.jetbrains.com/go/2018/10/02/goland-2018-3-early-access-program/#testify-support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants