英文:
How to output the test command Ginkgo uses
问题
我有一个Ginkgo测试套件,其中包含许多测试文件。
我可以使用以下命令运行测试套件中的所有测试,其中./controller
是包含所有测试的包。
go test ./controllers/... -v --args --ginkgo.vv
假设./controller
文件夹中有以下文件:
add_pods.go
add_pods_test.go
update_status.go
update_status_test.go
我想找出如何仅运行update_status_test.go
。
go test ./controller -run update_status
无法工作,因为它找不到任何测试。
我能让ginkgo输出它用于运行每个测试的go test
命令吗?
这可以给我提示,让我知道如何专注于运行单个测试。
英文:
I have a Ginkgo test suite that has many test files.
I can run all tests under the test suite with the following command, where ./controller
is the package that has all tests.
go test ./controllers/... -v --args --ginkgo.vv
say ./controller folder has the following files
add_pods.go
add_pods_test.go
update_status.go
update_status_test.go
I want to figure out how to run update_status_test.go alone.
The go test ./controller -run update_status
doesn't work because it cannot find any test.
Can I let ginkgo output the go test
command it uses to run each test?
That can give me hint on how to focus on a single test to run.
答案1
得分: 1
是的,根据文档(使用 ginkgo 1.16.5),使用选项 -x go test
将显示要运行的 go test
命令(-n go test
也可以在不运行测试的情况下显示命令)。
ginkgo help
...
-x go test
让 go test 打印命令。
...
-n go test
让 go test 打印命令,但不运行它们。
英文:
Yes following to documentation (using ginkgo 1.16.5). Using options -x go test
will display the go test
command to run (-n go test
also does it without running tests).
ginkgo help
...
-x go test
Have go test print the commands.
...
-n go test
Have go test print the commands but do not run them.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论