如何在我的项目中“测试”所有测试? [英] How to `go test` all testings in my project?
本文介绍了如何在我的项目中“测试”所有测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
go test
命令仅在一个目录中覆盖 * _ test.go
文件。 我想要 go test
整个项目,这意味着测试应该覆盖所有 * _ test.go
./ 中的code>文件以及dir ./
下的每个chindren树目录。
这样做的命令是什么?
解决方案
在当前目录及其所有子目录中:
$ go test。/ ...
这应该运行所有带有前缀 foo /
的导入路径的测试:
$ go test foo / ...
这应该运行前缀为 foo
的所有测试导入路径:
$ go test foo ...
这应该在您的$ GOPATH中运行所有测试:
$ go test ...
The go test
command covers *_test.go
files in only one dir.
I want to go test
the whole project, which means the test should cover all *_test.go
files in the dir ./
and every chindren tree dir under the dir ./
.
What's the command to do this?
解决方案
This should run all tests in current directory and all of its subdirectories:
$ go test ./...
This should run all tests with import path prefixed with foo/
:
$ go test foo/...
This should run all tests import path prefixed with foo
:
$ go test foo...
This should run all tests in your $GOPATH:
$ go test ...
这篇关于如何在我的项目中“测试”所有测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文