[Go] go test单元测试执行指定测试函数

go test 能够执行单元测试 , 通常把全部go文件测试单元都执行一遍html

如今若是想要执行某一个指定的测试函数 , 能够像这样ide

 

go test -v  -run  测试函数名字函数

 

例如:post

rpc_test.go单元测试

 

package tools

import (
    "go-fly-muti/frpc"
    "testing"
)

func TestClientRpc(t *testing.T) {
    frpc.ClientRpc()
}
func TestServerRpc(t *testing.T) {
    frpc.NewRpcServer("127.0.0.1:8082")
}

执行 TestClientRpc函数测试

go test -v -run TestClientRpcspa

相关文章
相关标签/搜索