在漫游器中找不到名称为"="的关键字 [英] No keyword with name '=' found in robot

查看:99
本文介绍了在漫游器中找不到名称为"="的关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用机器人框架编写一个测试用例.我在下面的json字符串中得到响应:

I'm writing a test case in robot framework. I'm getting the response in below json string:

{"responseTimeStamp":"1970-01-01T05:30:00",
 "statusCode":"200",
 "statusMsg":"200",
 "_object":{"id":"TS82",
            "name":"newgroup",
            "desc":"ttesteste",
            "parentGroups":[],
            "childGroups":[],
            "devices":null,
            "mos":null,
            "groupConfigRules" {
                "version":null,
                "ruleContents":null
            },
            "applications":null,"type":0
           }
}

从那开始,我想使用"_object":

From that I want to take "_object" using:

${reqresstr}        =       ${response['_object']}

...但是出现错误找不到名称为'='的关键字"错误

... but am getting the error "No keyword with name '=' found" error

如果我尝试以下操作:

${reqresstr}=       ${response['_object']}

...我收到错误消息关键字名称不能为空".我尝试删除'=',但仍然收到相同的错误.

... I'm getting the error "Keyword name cannot be empty." I tried removing the '=' but still get the same error.

如何从该json字符串中提取"_object"?

How can I extract '_object' from that json string?

推荐答案

使用"="以空格分隔格式进行变量分配时,必须确保在"="周围只有一个空格.您的第一个示例表明,"="的两边都有多个空间.两侧都只能有一个空格,否则机器人会认为这些空格是关键字和参数之间的分隔符.

When using the "=" for variable assignment with the space separated format you must make sure you only have a single space surrounding the "=". Your first example shows that you've got more than one space on either side of the "=". You must have only a single space on either side, or robot will think the spaces are a separator between a keyword and argument.

对于关键字不能为空"错误,变量名后的第一个单元格必须是关键字.与传统编程语言不同,您不能直接将字符串分配给变量.

For the "keyword must not be empty" error, the first cell after a variable name must be a keyword. Unlike traditional programming languages, you cannot directly assign a string to a variable.

要将变量设置为字符串,您需要使用设置变量关键字(或其中一种变体,例如设置测试变量).例如:

To set a variable to a string you need to use the Set Variable keyword (or one of the variations such as Set Test Variable). For example:

${reqresstr}=      Set variable  ${response['_object']}

这篇关于在漫游器中找不到名称为"="的关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆