基于Socket.IO的白板点阵坐标传输接口测试实践

2021-01-27 15:33:10 浏览数 (1)

测试脚本

代码语言:javascript复制
    private static Logger logger = LoggerFactory.getLogger(ST.class)

    static int roomId = 44465;

    static int activity_id = roomId;

    public static void main(String[] args) {
        def tbase = getTeaBase()
        def sbase = getStuBase()
        initAll()
        registerAll()
        joinRoom(roomId)

        BoardUser boardUser = new BoardUser(Users.getTeaUser(0))
        List<String> list = boardUser.writeCircle()
        teacher.send(EVENT, showWhite(roomId))
        teacher.send(EVENT, showWhiteStatus(roomId))
        list.each {
            teacher.send(EVENT, sendWhiteData(it, roomId))
        }
        
        sleep(5.0)
        teacher.send(EVENT, showWhite(roomId))
        waitForKey(DEFAULT_STRING)
        leaveRoom(roomId)

        ScoketIOFunClient.closeAll()
    }

}

控制台输出

接口响应

由于数据量太大了,我只截取了一部分具有代表性的。

代码语言:javascript复制

10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,-116,-125,-24,-128,-127,-27,-72,-120,-23,-101,-74,-23,-101,-74,-23,-101,-74,1,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,98,100,50,55,45,52,97,52,51,48,102,52,55,99,53,98,54,-107,-51,19,-90,-51,20,10,-51,1,44,-51,19,-60,-51,20,60,-51,1,44,-51,19,-30,-51,20,120,-51,1,44,-51,20,20,-51,20,-66,-51,1,44,-51,20,70,-51,21,4,-51,1,44],"pageNo":0,"cmd":"wbData","id":1608883690000433777,"roomId":44465},"cmd":"wbDataResponse"}]
10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,-116,-125,-24,-128,-127,-27,-72,-120,-23,-101,-74,-23,-101,-74,-23,-101,-74,1,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,98,100,50,55,45,52,97,52,51,48,102,52,55,99,53,98,54,-107,-51,20,-116,-51,21,84,-51,1,44,-51,20,-26,-51,21,-92,-51,1,44,-51,21,64,-51,21,-22,-51,1,44,-51,21,-72,-51,22,58,-51,1,44,-51,22,48,-51,22,-128,-51,1,44],"pageNo":0,"cmd":"wbData","id":1608883690000433778,"roomId":44465},"cmd":"wbDataResponse"}]
10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,-116,-125,-24,-128,-127,-27,-72,-120,-23,-101,-74,-23,-101,-74,-23,-101,-74,1,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,98,100,50,55,45,52,97,52,51,48,102,52,55,99,53,98,54,-107,-51,22,-68,-51,22,-68,-51,1,44,-51,23,92,-51,22,-8,-51,1,44,-51,24,6,-51,23,42,-51,1,44,-51,24,-70,-51,23,72,-51,1,44,-51,25,120,-51,23,102,-51,1,44],"pageNo":0,"cmd":"wbData","id":1608883690000433779,"roomId":44465},"cmd":"wbDataResponse"}]

能够正确收到响应消息了。

业务关联接口验证

这里有一个关联接口,就是joinRoom接口,每次进入改房间的用户,都会收到一个wbFullDataNotify的通知信息,会把当前房间白板的状态和笔画细节推送给端上。

  • 数据量比较大,我删了一部分。
代码语言:javascript复制
10:40:00 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"maxId":1608883690000433800,"data":[1,100,-90,115,101,114,118,101,114,-110,-51,4,-80,-51,2,-7,-112,-51,4,-80,-51,2,-7,-111,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,-51,1,44,-51,19,-120,-51,19,-100,-51,1,44,-51,19,-120,-51,19,-120,-51,1,44,-51,19,-120,-51,19,-120,-51,1,44],"roomId":44465,"ts":1611196360610},"cmd":"wbFullDataNotify"}]


FunTester,非著名测试开发,文章记录学习和感悟,欢迎关注,交流成长。

  • 2020年FunTester自我总结
  • 避免PPT自动化的最佳实践
  • 固定QPS压测初试
  • 如何测试概率型业务接口
  • JSON对象标记语法验证类
  • 无数据驱动自动化测试
  • 测试模型中理解压力测试和负载测试
  • 简化测试用例
  • 敏捷测试二三事
  • 自动化测试生命周期
  • moco固定QPS接口升级补偿机制
  • 利用微基准测试修正压测结果

点击阅读原文,查看公众号历史文章- END -

0 人点赞