Skip to content

Multiple tests with a similar name get executed when running go test with -testify.m option #1107

Open
@hcbt

Description

@hcbt

When running my test suite I have noticed that it gets stuck on some tests even if they work fine when I run them independently, each test in suite is independent so order in which you run them does not matter. I have investigated further and noticed that running go test -testify.m TestName runs multiple tests that have a similar name.

For example running:
go test -v mongodb_test.go -testify.m TestMongoDBGetAccount

Gives a following output:

=== RUN   TestGuestAccessTestSuite
=== RUN   TestGuestAccessTestSuite/TestMongoDBGetAccount
time="2021-07-30T14:49:17+03:00" level=info
=== RUN   TestGuestAccessTestSuite/TestMongoDBGetAccountByPortalIDAndUsername
time="2021-07-30T14:49:17+03:00" level=info
=== RUN   TestGuestAccessTestSuite/TestMongoDBGetAccountStatistics
time="2021-07-30T14:49:17+03:00" level=info
=== RUN   TestGuestAccessTestSuite/TestMongoDBGetAccountsByPortal
time="2021-07-30T14:49:17+03:00" level=info
--- PASS: TestGuestAccessTestSuite (0.46s)
    --- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccount (0.05s)
    --- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccountByPortalIDAndUsername (0.10s)
    --- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccountStatistics (0.10s)
    --- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccountsByPortal (0.21s)
PASS
ok  	command-line-arguments	0.475s

Is this an intended behaviour or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions