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

testing: run subtest with its name without knowing how many parents it has #30766

Closed
santhosh-tekuri opened this issue Mar 12, 2019 · 2 comments
Labels
FeatureRequest FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@santhosh-tekuri
Copy link
Contributor

This is feature request.

What version of Go are you using (go version)?

$ go version
go version go1.10.3 windows/amd64

Usecase:

I have lots of subtests with deep hierarchy. I changed some code and would like to test my changes.
I know the test name, but does not know how nested the test is.

I would like to do: go test -run .../mytest

currently I try: go test -run /mytest
if it says no tests run, i try go test -run //mytest
and so on (adding one slash until it matches)

@julieqiu
Copy link
Member

julieqiu commented Mar 12, 2019

@santhosh-tekuri - are you looking for commands to run all tests, such as:

go test ./...
go test -run ''

From the documentation: https://golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks

go test -run ''      # Run all tests.
go test -run Foo     # Run top-level tests matching "Foo", such as "TestFooBar".
go test -run Foo/A=  # For top-level tests matching "Foo", run subtests matching "A=".
go test -run /A=1    # For all top-level tests, run subtests matching "A=1".

If not, would you be able to provide more information about this issue, including a code sample?

@julieqiu julieqiu added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. FeatureRequest labels Mar 12, 2019
@santhosh-tekuri
Copy link
Contributor Author

after thinking a bit, it seems I am trying to do opposite. I should know which top tests to run after my code change rather than which leaf tests to run. With the correct approach, the behavior seems pleasing.

any way thanks for the patience.

@golang golang locked and limited conversation to collaborators Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants