如何输出Ginkgo使用的测试命令?

huangapple go评论78阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年3月18日 02:48:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75771170.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定