python - 机器人框架测试不运行

标签 python robotframework

我已经安装了 python 版本 3.5.1 和机器人框架。 我写了下面的测试(我试过其他人也有同样的结果):

*** Settings ***
Library       Selenium2Library

*** Variables ***
${MESSAGE}    Start of test
${BROWSER}      ff
${keywork}  dell

*** Test Cases ***
Search Emag For Computer
    [Documentation]    Example test
    Log    ${MESSAGE}
    Do this     www.emag.ro     dell        "rezultate pentru"


*** Keywords ***
Do this
    [Arguments]    ${URL}    ${keyword}     ${result}
    Open Browser    ${BROWSER}
    Input Text      id=emg-input-autosuggest        ${keyword}
    Wait 20
    Close Browser

当使用 robot testName.rst 从控制台运行测试时 我总是得到: [错误] 解析“testName.rst”失败:文件没有测试用例表。 但是我的测试用例表显然在那里。 请帮忙

最佳答案

您正在使用 .rst 后缀,这意味着 reStructuredText格式,但您的文件是以纯文本格式编写的。由于后缀,机器人试图根据 reStructuredText 语法对其进行解析,而您没有该格式的任何测试表。

您可以通过将文件重命名为 testName.txttestName.robot 来解决此问题。

关于python - 机器人框架测试不运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35016227/

相关文章:

Python argparse : Lots of choices results in ugly help output

python - 如何在 Python 中将列表的整数项作为字符串参数传递给函数?

python - 如何将 SQL 查询结果分配给变量(Robot Framework)以输入应用程序编辑文本?

python - 在 python 中已经打开的 url 上发送 POST 请求

python - pip 安装 hunspell : Cannot open include file: 'hunspell.h' : No such file or directory

python - 仅在测试设置中使用机器人框架自定义关键字

ios - 如何完全删除 calabash-ios/robotframework

python - 使用 Robot Framework 从 Python 中的方法返回值

python - 机器人框架 : pythonpath argument not working when run method of api is used

python - Matplotlib 中的空、零和非零像素表示