可以在Robotframework代码的关键字部分下运行“运行关键字If”

时间:2014-12-29 10:14:22

标签: robotframework

我试图执行Robot框架代码的这种和平。 我总是得到一个错误 "运行关键字"如果声明 错误消息:没有带名称的关键字'运行关键字如果' $ {checkmessageoutput}' =='预期的飞机ID,即MLH001''找到。

非常感谢任何帮助。

是否无法使用

*** Settings ***

Documentation     A Test of the TAS-APP-FDD-3
...               Kari Dec 2014

Suite Setup       fdd attach to application

Library           BuiltIn
Library           fddlibrary

*** Test Cases ***
Send a valid flight plan
    [Template]  send a flightplan
    FI352   \

Fill out a flight plan missing callsign
    [Template]  send a flightplan
    /   Expected aircraft ID, i.e. MLH001  

*** Keyword ***
fill out flight plan
     fdd select msg
     fdd msg select fpl
     fdd msg fpl priority                  FF
     fdd msg fpl ssr                       1234
     fdd msg fpl flightrules               I
     fdd msg fpl flighttype                S
     #fdd msg fpl callsign                  FI351
     fdd msg fpl aircrafttype              A310
     fdd msg fpl wakecategory              H
     fdd msg fpl equipmentcommnav          SHIR
     fdd msg fpl equipmentsurveillance     S
     fdd msg fpl departureairport          BIKF
     fdd msg fpl departuretime             0800
     fdd msg fpl crusingspeed              M080
     fdd msg fpl cruisinglevel             F300
     fdd msg fpl route                     ALDAN RATSO
     fdd msg fpl destinationairport        EKCH
     fdd msg fpl eet                       0300
     fdd msg fpl otherinformation          Flightplan 1

send a flightplan
    [arguments]     ${callsign}     ${checkmessageoutput}  
    fill out flight plan
    fdd msg fpl callsign              ${callsign}
    check flight plan                 ${checkmessageoutput}
    Run Keyword If '${checkmessageoutput}' == 'Expected aircraft ID, i.e. MLH001'     log to console     \nRun send flight plan
    ELSE  log to console     \nRun send no flight plan      

check flight plan
    [arguments]                     ${checkmessageoutput} 
    fdd msg fpl check message
    ${message}=     fdd msg fpl return message
    Should be equal     ${message}  ${checkmessageoutput}       

send flight plan
    fdd msg fpl send message

display strip     
    fdd select flights
    fdd flights display electronic strip

1 个答案:

答案 0 :(得分:2)

仔细查看错误消息:

No keyword with name 'Run Keyword If '${checkmessageoutput}' == 'Expected aircraft ID, i.e. MLH001'' found.

请注意,说没有名为Run Keyword If的关键字,而是Run Keyword If '${check...。换句话说,您在关键字及其参数之间缺少一个分隔符,因此它认为整个句子是一个关键字。在Run Keyword If之后添加其他空格或标签或您正在使用的任何内容。

这些错误是我推荐使用管道分隔格式的原因 - 这种类型的错误几乎从未发生过,并且诊断起来要容易得多。