1 回答
TA贡献1797条经验 获得超6个赞
传递符合测试名称的正则表达式应运行匹配的测试...
例如:
go test -v -cover --short -race ./... -run ^TestError*
运行不同的测试,这些测试从项目中的测试错误开始...
? github.com/user/project/internal/rabbitmq [no test files]
=== RUN TestErrorMiddleware
printer.go:54: GET http://localhost:45678/surprise
⇨ http server started on [::]:45678
{"error":{"code":"EXPECTED","status":418},"level":"warning","msg":"expected: here's tea","time":"2021-08-06T17:25:58+03:00"}
--- PASS: TestErrorMiddleware (0.01s)
PASS
coverage: 54.8% of statements
ok ithub.com/user/project/internal/datadog 3.725s coverage: 70.6% of statements
? github.com/user/project/internal/ftp [no test files]
? github.com/user/project/internal/mongo [no test files]
testing: warning: no tests to run
PASS
coverage: 0.0% of statements
ok github.com/user/project/postgres 3.704s coverage: 0.0% of statements [no tests to run]
ok github.com/user/project/escrow 7.784s coverage: 0.0% of statements [no tests to run]
=== RUN TestError
--- PASS: TestError (0.00s)
=== RUN TestErrorHandling
--- PASS: TestErrorHandling (0.00s)
PASS
coverage: 70.6% of statements
...
目标对象是测试的名称(函数名称以Test)
- 1 回答
- 0 关注
- 72 浏览
添加回答
举报