在golang中使用goconvey明确指定要运行测试的主包。

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

Explicitly specifying the main package to run tests for in golang with goconvey

问题

你可以使用以下命令来只运行主包中的测试,而不运行其他包中的测试:

go test -v ./...

这将运行当前目录下所有包的测试。如果你只想运行主包的测试,可以使用以下命令:

go test -v .

这将只运行当前目录中的主包测试。希望对你有帮助!

英文:

How do I explicitly say with my go test command to run only tests for the main package and not others in my source directory.

At the moment it's working with $go test -v. But... I am using goconvey as well and it seems to be running recursively. According to this page https://github.com/smartystreets/goconvey/wiki/Profiles I have a file where I can pass arguments into the go test command. I know you can go test -v ./... for recursive or go test -c packagename/... but how do I just do it for the main?

答案1

得分: 1

Profiles是一种实现这一目标的方法,但你也可以为runner指定一个'depth':

$ goconvey -depth=0

值为0将限制runner在工作目录中运行。

运行goconvey -help以获取详细信息。

英文:

Profiles is one to accomplish this, but you can also specify a 'depth' for the runner:

$ goconvey -depth=0

A value of 0 limits the runner to the working directory.

Run goconvey -help for details.

huangapple
  • 本文由 发表于 2015年5月19日 09:37:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/30315395.html
匿名

发表评论

匿名网友

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

确定