美文网首页
go test使用

go test使用

作者: 帘外五更风 | 来源:发表于2019-12-25 17:40 被阅读0次

    相关使用命令

    $ go test xxx_test.go  xxx.go  -c 
    # -c 编译生成 pkg.test文件(pkg是引用包名最后一个元素),可以使用-o参数重新对文件命名。
    # -c参数 Compile the test binary to pkg.test but do not run it (where pkg is the last element of the package's import path).The file name can be changed with the -o flag.
    $ ./xxx.test -test.run TestFunctionName
    # 执行生成的test文件。可以使用-test.run参数指定想要执行的测试函数名称,不指定则全部执行。
    # 使用可执行文件执行目前我自己主要是在可以加载一些flag参数之类的,比较好操作一点
    
    

    相关文章

      网友评论

          本文标题:go test使用

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