英文:
Gogland Test Configuration always executed with ./
问题
无论我如何设置构建配置来运行我的测试,go test工具总是使用./...运行。
例如:
运行命令:
go test -v -cover ./... -run ./svs
英文:
No matter how I set my build configuration for running my tests the go test tool is always run with ./...
E.G.
runs:
go test -v -cover ./... -run ./svs
答案1
得分: 3
根据您需要运行的内容,您可以选择不同的配置类型。
对于您图片中的那个配置,选择了“运行类型:目录”,这意味着IDE将在您指定的目录中运行测试,并且由于工作目录与该目录相同,它将运行 ./...
,因为这就是它的含义。
对于“运行类型:包”,它将仅运行指定的包,而不运行其他包,因此不会附加 /...
。
对于“运行类型:文件”,它将运行单个文件中的测试。
您添加的模式 ./svc
告诉go工具如何匹配测试名称。在那里,您应该放置有效的测试名称模式。如果您想控制运行哪个目录/包中的测试,可以为每个目录/包使用不同的运行配置,因为可以有多个配置。
根据您的回复,您希望递归地运行整个项目中的测试,但不包括 vendor 文件夹。为此,请创建一个“运行类型:目录”的配置,就像您已经有一个一样,并确保您正在使用Go 1.9,因为它在使用 ./...
匹配时会自动忽略 vendor
目录。
如果您需要进一步的详细信息,请告诉我。
英文:
Depending on what you need to run you can select different configuration types.
For the one in your picture, Run Kind Directory is selected and that means the IDE will run the tests in the directory you point it at and since the working directory is in the same directory, it will run ./...
as that's what it means.
For the Run Kind Package, it will run only the specified package and no other packages, so no /...
appended to it.
For the Run Kind File it will run the tests in a single file.
The pattern that you've added, ./svc
tells the go tool how to match test names. There you should put valid patterns for test names. If you want to control for which directory / package the tests are run you can use a different run configuration per directory / package since multiple configurations are possible.
Based on your reply you want to run the tests in your whole projects, recursive, without the vendor folder. To do so, create a Run Kind Directory, as you have one already, and make sure sure you are using Go 1.9 as it will automatically ignore the vendor
directory when using ./...
matching.
Please let me know if you need further details.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论