Automated tests 没有名称为&;的关键字;{headers}=在robot中找到创建字典

Automated tests 没有名称为&;的关键字;{headers}=在robot中找到创建字典,automated-tests,robotframework,Automated Tests,Robotframework,当我运行此测试(即测试网站中的登录页面)时,我得到“没有找到名为&{headers}=Create Dictionary的关键字”。如何使此测试正确运行 我以前安装过所有导入的库,并在其他测试中使用过它们,因此我知道它们已正确安装 *** Settings *** Library Collections Library RequestsLibrary Library OperatingSystem *** Variables *** ${authToken} ${u

当我运行此测试(即测试网站中的登录页面)时,我得到“没有找到名为&{headers}=Create Dictionary的关键字”。如何使此测试正确运行

我以前安装过所有导入的库,并在其他测试中使用过它们,因此我知道它们已正确安装

*** Settings ***
Library     Collections
Library     RequestsLibrary
Library     OperatingSystem
*** Variables ***
${authToken}   
${username} example.user@email.com
${password} password
*** Test Cases ***
Log in Dashboard
    &{data}=    Create Dictionary   email=${username}   password=${password}
    &{headers}= Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json   Origin=http://examplesite.com   Referer=http://examplesite.com/angular/
    Create session  example   http://examplesite.com
    ${response}=    Post Request    example   /admin/login data=${data}    headers=${headers}
    log ${response}
    log ${response.json()}
    ${allocation_response}= To Json ${response.content}
    Set Global  Variable
可能您的IDE太“智能”,即使您点击TAB,它也只在此处插入了一个空格:

&{headers}= Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json   Origin=http://examplesite.com   Referer=http://examplesite.com/angular/
变量和关键字之间似乎只有一个空格,因此它被视为一个关键字。请在此处添加更多空格以修复它

&{headers}=    Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json   Origin=http://examplesite.com   Referer=http://examplesite.com/angular/
可能您在这一行也会遇到同样的问题:

${allocation_response}= To Json ${response.content}
可能您的IDE太“智能”,即使您点击TAB,它也只在此处插入了一个空格:

&{headers}= Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json   Origin=http://examplesite.com   Referer=http://examplesite.com/angular/
变量和关键字之间似乎只有一个空格,因此它被视为一个关键字。请在此处添加更多空格以修复它

&{headers}=    Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json   Origin=http://examplesite.com   Referer=http://examplesite.com/angular/
可能您在这一行也会遇到同样的问题:

${allocation_response}= To Json ${response.content}