[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

相關文章
相關標籤/搜索