go test使用

2019-12-25  本文已影响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参数之类的,比较好操作一点

上一篇 下一篇

猜你喜欢

热点阅读