Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Robotframework RequestsLibrary robot框架的Get请求和Get方法有什么区别_Robotframework - Fatal编程技术网

Robotframework RequestsLibrary robot框架的Get请求和Get方法有什么区别

Robotframework RequestsLibrary robot框架的Get请求和Get方法有什么区别,robotframework,Robotframework,两者都有相同的参数,除了Get-Request有一个额外的json 这里有一个例子 Create Session httpbin http://httpbin.org &{params}= Create Dictionary key=value key2=value2 ${resp}= Get Request httpbin /get params=${params} log to console ${resp.content} 在第3行中

两者都有相同的参数,除了
Get-Request
有一个额外的json

这里有一个例子

Create Session  httpbin     http://httpbin.org
&{params}=   Create Dictionary   key=value     key2=value2
${resp}=     Get Request  httpbin  /get    params=${params}
log to console  ${resp.content}

在第3行中,get-method接受参数,我们可以一起使用get-Request和get-method吗?在导入
RequestsLibrary
后调用关键字
get-Request
时,我无法说明这两种方法在第3行中是如何工作的,该关键字调用方法
get\u request
,该方法是
RequestsLibrary
类定义的一部分。它们没有什么不同,一个只是内部方法的公共接口。当robot看到您调用
Get Request
关键字时,它会扫描库中名为
Get\u Request
的方法。然后调用库中的方法

调用关键字时,
get\u request
方法采用的任何参数都是完全有效的。同样,关键字和方法是相同的。它们是完全一样的东西

显然,您询问的
json
参数是最近添加的。我猜要么是这个版本的库还没有发布,要么是文档还没有更新


如果您计算机上的
RequestsLibrary
版本具有
json
参数,您可以在测试中使用该参数。

您所说的“获取方法”是什么意思?什么是“获取方法”?我在代码中没有看到调用“get方法”的地方。在第3行/get中,是RequestsLibrary的get方法还是参数?下面是库def get_请求的定义(self、别名、uri、headers=None、json=None、params=None、allow_redirects=None、timeout=None):在代码中,
/get
是一个参数。它用于构建库将调用的URL。感谢您的回复。但它出现在Get请求方法的哪个参数中?例如,我们指定like Json=some data param=/serviceS谢了,但我已经声明了任何http库,它是如何使用http@madhur:请求库进行http调用。谢谢你,Bryan。是RequestsLibrary robot框架的Get请求和Get方法之间的区别。就像我提到的,除了json,这两个函数在定义上有相同的参数。@madhur:对不起,我不理解这个问题。“RequestsLibrary”没有“get方法”。它有一个名为“Get Request”的关键字,还有一个名为“Get”的关键字,它只是“Get Request”的别名。请参阅第453行和第491行