You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
Follow the doc, testify.m means regular expression to select tests of the testify suite to run, the behavior is expected. You need to use go test -v mongodb_test.go -testify.m TestMongoDBGetAccount$ to match.
test % go test -v main_test.go -testify.m=TestMongoDBGetAccount
=== RUN TestGuestAccessTestSuite
=== RUN TestGuestAccessTestSuite/TestMongoDBGetAccount
=== RUN TestGuestAccessTestSuite/TestMongoDBGetAccountByPortalIDAndUsername
--- PASS: TestGuestAccessTestSuite (0.00s)
--- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccount (0.00s)
--- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccountByPortalIDAndUsername (0.00s)
PASS
ok command-line-arguments 0.011s
test % go test -v main_test.go -testify.m=TestMongoDBGetAccount$
=== RUN TestGuestAccessTestSuite
=== RUN TestGuestAccessTestSuite/TestMongoDBGetAccount
--- PASS: TestGuestAccessTestSuite (0.00s)
--- PASS: TestGuestAccessTestSuite/TestMongoDBGetAccount (0.00s)
PASS
ok command-line-arguments 0.011s
test %
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:
Is this an intended behaviour or am I doing something wrong?
The text was updated successfully, but these errors were encountered: