No keyword with name '${body}= Create Dictionary' found

放肆的年华 提交于 2021-02-17 07:16:19

问题


*** settings ***

Library  RequestsLibrary
Library  Collections
Library  OperatingSystem
Library  SeleniumLibrary

*** Variables ***

${username}     XXXXXX

${password}     YYYYYY

${locale}       ZZZZ


*** test cases ***

TC1

            ${body}= Create Dictionary  username=       ${username}  password=      ${password}
            ${header}= Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json, Accept-Language=${locale},   
            Create Session OA2  ${base_url}
            ${response}= post request   OA2 /oauth/v2/token   data=     ${body}    headers=     ${header}
            log to console  ${response.status_code}
            log to console  ${response.content}

回答1:


You must follow space separated format.

In following code line (and others) you seem to only use 1 space between variable and keyword ${body}= Create Dictionary.
That's why robot can not parse the code correctly and the error is raised.
Expand that code to use at least 2 space separation.
You should try the code like this.
${body}= Create Dictionary username=${username} password=${password}

And of course revise rest of the code accordingly.

I also recommend you study the user guide.
It contains a lot of useful information.



来源:https://stackoverflow.com/questions/64010906/no-keyword-with-name-body-create-dictionary-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!