【问题标题】:Can "Run Keyword If" not be run under the keyword section of Robotframework codeRobotframework代码的关键字部分下可以不运行“Run Keyword If”吗
【发布时间】:2014-12-29 10:14:21
【问题描述】:

我正在尝试执行 Robot 框架代码的这种和平。 我总是收到错误 “运行关键字”If 语句 错误消息:找不到名为“Run Keyword If '${checkmessageoutput}' == 'Expected aircraft ID, i.e. 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

【问题讨论】:

  • Library BuiltIn in Settings 是不必要的,因为它是自动导入的。

标签: robotframework


【解决方案1】:

仔细查看错误信息:

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 之后添加另一个空格或制表符或您正在使用的任何内容。

这些类型的错误是我推荐使用管道分隔格式的原因——这种类型的错误几乎不会发生,而且更容易诊断。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-13
    • 2019-05-15
    • 1970-01-01
    • 1970-01-01
    • 2021-06-15
    • 1970-01-01
    相关资源
    最近更新 更多