go test 测试执行单个用例

作者: 小骑手 | 来源:发表于2019-10-11 11:52 被阅读0次

    go test 只跑某个测试用例

    如有以下用例在包 foo/test 中:

    func TestFoo(t *testing.T){}

    func TestFoo1(t *testing.T){}

    func TestAbc(t *testing.T){}

    1. go test -v foo/test

    将测试所有的用例 (-v 表示输出详细信息,无论成功失败)

    2. go test -v -run TestFoo foo/test

    将测试 TestFoo 和 TestFoo1

    3. go test -v -run ^TestFoo$ foo/test

    将只测试 TestFoo

    相关文章

      网友评论

        本文标题:go test 测试执行单个用例

        本文链接:https://www.haomeiwen.com/subject/pbstmctx.html