diff --git a/cmd/robot/friend.go b/cmd/robot/friend.go index d4d0cb9ac..47232d460 100644 --- a/cmd/robot/friend.go +++ b/cmd/robot/friend.go @@ -8,7 +8,7 @@ import ( var ( //friend - friendBuilders = []*testCase{ + friendBuilders = []*TestCase{ { //list mainType: string(comm.ModuleFriend), diff --git a/cmd/robot/hero.go b/cmd/robot/hero.go index 15958b5ac..0d9a77c36 100644 --- a/cmd/robot/hero.go +++ b/cmd/robot/hero.go @@ -11,7 +11,7 @@ import ( var ( //hero - heroBuilders = []*testCase{ + heroBuilders = []*TestCase{ { desc: "英雄列表", mainType: string(comm.ModuleHero), diff --git a/cmd/robot/job.go b/cmd/robot/job.go index bc15dcf44..52c857c25 100644 --- a/cmd/robot/job.go +++ b/cmd/robot/job.go @@ -1,7 +1,7 @@ package robot type CaseNode struct { - caseName testCase //用例名 + testCase TestCase //用例名 next *CaseNode //测试用例 } @@ -13,4 +13,14 @@ func NewLinkCase() *LinkCase { return &LinkCase{} } +func (this *LinkCase) isEmpty() bool { + return this.head == nil +} +func (this *LinkCase) append(testCase *TestCase) { + newNode := &CaseNode{testCase: *testCase} + if this.isEmpty() { + this.head = newNode + } + +} diff --git a/cmd/robot/login.go b/cmd/robot/login.go index 0a907c2ae..7100eaf65 100644 --- a/cmd/robot/login.go +++ b/cmd/robot/login.go @@ -35,7 +35,7 @@ func (r *Robot) BuildSecStr() string { //处理登录请求 func (r *Robot) AccountLogin() { log.Printf("区服:[%d] 账号:[%s] login...", r.opts.ServerId, r.opts.Account) - builders := []*testCase{ + builders := []*TestCase{ { mainType: string(comm.ModuleUser), subType: user.UserSubTypeLogin, diff --git a/cmd/robot/notify.go b/cmd/robot/notify.go index 61bb3fde5..effd2412e 100644 --- a/cmd/robot/notify.go +++ b/cmd/robot/notify.go @@ -5,7 +5,7 @@ import ( "go_dreamfactory/pb" ) -var notify_builders = []*testCase{ +var notify_builders = []*TestCase{ { //create mainType: comm.MainTypeNotify, diff --git a/cmd/robot/pack.go b/cmd/robot/pack.go index aeeba61b2..565b8b2dc 100644 --- a/cmd/robot/pack.go +++ b/cmd/robot/pack.go @@ -6,7 +6,7 @@ import ( ) //申明测试接口及请求和响应参数 -var pack_builders = []*testCase{ +var pack_builders = []*TestCase{ { //create mainType: string(comm.ModulePack), diff --git a/cmd/robot/robot.go b/cmd/robot/robot.go index 953d08959..c1790faed 100644 --- a/cmd/robot/robot.go +++ b/cmd/robot/robot.go @@ -20,7 +20,7 @@ type Robot struct { ws *websocket.Conn opts *Options user *pb.DBUser - builders []*testCase + builders []*TestCase } func NewRobot(opts *Options) *Robot { @@ -67,7 +67,7 @@ func (r *Robot) Run() { select {} } -type testCase struct { +type TestCase struct { desc string mainType string subType string @@ -79,7 +79,7 @@ type testCase struct { print func(rsp proto.Message) } -func (r *Robot) addBuilders(builders []*testCase) { +func (r *Robot) addBuilders(builders []*TestCase) { for _, b := range builders { if b.enabled { r.builders = append(r.builders, b) @@ -199,7 +199,7 @@ func (r *Robot) AccountRegister(account string, sid int32) { fmt.Printf("account:%s 注册成功", regRsp.Account) //登录 - var user_builders = []*testCase{ + var user_builders = []*TestCase{ { desc: "登录", mainType: "user", @@ -218,7 +218,7 @@ func (r *Robot) AccountRegister(account string, sid int32) { } //打印响应 -func printReply(msg *pb.UserMessage, builder *testCase) { +func printReply(msg *pb.UserMessage, builder *TestCase) { if m, ok := builder.rsp.(*pb.NotifyErrorNotifyPush); ok { var tt time.Duration if builder.start.IsZero() { diff --git a/cmd/robot/user.go b/cmd/robot/user.go index cd78bdd8e..c11d030f3 100644 --- a/cmd/robot/user.go +++ b/cmd/robot/user.go @@ -7,7 +7,7 @@ import ( ) //申明测试接口及请求和响应参数 -var user_builders = []*testCase{ +var user_builders = []*TestCase{ { //create desc: "创角",