RESTinstance 讲解 GET and Output 以及基本验证

简单记录一下Restinstance Library,因为发现没有什么中文介绍的资料。

RESTinstance只是一个用来测试API的library, 主要处理的格式是json格式。语法比较简单。但是对于新手而言。由于网上资料太少,还是有点难以下手。

使用的工具是:pycharm+ robot framework.

目标: 如何使用Restinstance 来进行数据验证。 

*** Settings ***
Library REST http://localhost:30100/api #设置Library, 和最前面那一截链接

*** Test Cases ***
get the first user, check the output
GET /connections/0 #创建一个新的实例, 和setttings里面的 链接拼成一个,http://localhost:30100/api/connections/ ,通过这个实例,应该会得到一组数据。
    Output   response body          #查看返回的数据。
    Integer  response body port     3306   #验证返回来的端口是不是3306, 从output我们可以得到返回的数据集。从数据集里我们知道返回的是整型。 使用integer。 需要注意的是语法问题。response body port 是连在一起,中间只隔了一个空格,多了会有语法问题
    String   response body connectiontype  MySQLNative     #验证返回的类型是字符类型,返回来的值是MySQLNative



猜你喜欢

转载自www.cnblogs.com/xiangjiaoai/p/11434302.html