【问题标题】:How to test ignoring some test files in golang?如何测试忽略golang中的一些测试文件?
【发布时间】:2019-07-25 05:06:31
【问题描述】:

我曾经在 CI 中使用go test ./...。这将测试所有xxx_test.go 文件。但是现在我希望这个测试用例忽略以-TestClient 结尾的文件夹中的一些测试文件。怎么办?

例如:

XFolderTestClient
    | -- xxx_test.go                    x
    | -- xxx2_test.go                   x


AnotherFolder
    | -- yyy.go                         √
...

我只想忽略以 TestClient 结尾的文件夹中的测试文件。

3Q~

【问题讨论】:

标签: go


【解决方案1】:

您可以使用run 标志来传递正则表达式/模式ala:

go test -run YourRegex

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-14
    • 2019-09-30
    • 2017-11-27
    • 1970-01-01
    • 2017-07-09
    • 1970-01-01
    • 1970-01-01
    • 2016-02-25
    相关资源
    最近更新 更多