go test 可以执行单元测试 , 一般把所有go文件测试单元都执行一遍

现在如果想要执行某一个指定的测试函数 , 可以像这样

 

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

 

例如:

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 TestClientRpc

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2022-02-09
  • 2021-11-30
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-04
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2021-10-06
  • 2021-12-06
  • 2022-01-27
相关资源
相似解决方案