go_dreamfactory/cmd/robot
2022-07-12 16:12:29 +08:00
..
friend.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
hero.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
linkcase.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
login.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
notify.go 修改响应命名 2022-07-04 10:13:39 +08:00
options.go 修复机器人测试逻辑 2022-06-16 15:13:25 +08:00
pack.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
readme.md update robot 2022-06-27 20:27:49 +08:00
robot.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
task.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00
user.go 测试用例支持递归处理 2022-07-12 16:12:29 +08:00

Robot使用

命令行

#使用已存在的账号测试接口
go run cmd.go run --account yourAccount
#使用新账号测试接口
go run cmd.go run --account newAccount --create true

@[TOC]

添加测试接口

  • 声明测试接口
var user_builders = []*builder{
 {
  //create
  mainType: string(comm.SM_UserModule),
  subType:  user.User_SubType_Create,
  req: &pb.UserCreateReq{ //设置请求参数
   NickName: "测试",
  },
  rsp:     &pb.UserCreateRsp{},
  enabled: true,
 },
}

声明加入到构建器并发起请求

func (r *Robot) RunUser() {
 r.addBuilders(user_builders)
 r.handleReq()
}

添加用户登录之后需要测试的接口

func (r *Robot) onUserLoaded() {
 //添加用户登录之后需要测试的接口
 r.RunUser()
}