【发布时间】:2014-05-17 20:56:51
【问题描述】:
以下是我在测试用例和套件 (__init__.txt) 文件中引用的 resource.txt。我想在执行映射到静态 API(RobotLibrary)的关键字后获得结果,然后将结果传递回相同的静态 API(RobotLibrary)模块以断言结果。我试图将结果作为状态保存在 RobotLibrary 中,但这可能不起作用,因为 RobotLibrary 是跨多个测试的单个实例?我不介意通过关键字返回结果并将它们作为参数返回给后续调用。
*** Settings ***
Library ${CURDIR}${/}..${/}src${/}RobotLibrary.py
*** Keywords ***
[return] ${result_run}
when the configuration file "${filename}" is used to run the journey
${result_run}= start journey with config ${filename}
when the route has a route code of "${routecode}"
use route code ${routecode}
journey status should be "${status}"
assert journey status ${status}
stop with name "${stopName}" should have an arrival time
assert stop has arrival time ${stopName} ${result}
这不起作用,以下是我在控制台中看到的消息。
(acceptance_test)[root@localhost jsf_acceptance_test]# pybot -L TRACE robot-tests/manual/Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1/
==============================================================================
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1 :: Mandatory-Delayed-S0-Man...
==============================================================================
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1.Mandatory-Delayed-S0-Mandat...
==============================================================================
Ensure feedback for stop stop0 on route CGXD | FAIL |
Parent suite setup failed:
No keyword with name '${result_run}= start journey with config' found.
------------------------------------------------------------------------------
Ensure feedback for stop stop1 on route CGXD | FAIL |
Parent suite setup failed:
No keyword with name '${result_run}= start journey with config' found.
------------------------------------------------------------------------------
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1.Mandatory-Delayed-... | FAIL |
Parent suite setup failed:
No keyword with name '${result_run}= start journey with config' found.
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================
Mandatory-Delayed-S0-Mandatory-Delayed-S1-329-1 :: Mandatory-Delay... | FAIL |
Suite setup failed:
No keyword with name '${result_run}= start journey with config' found.
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================
Output: /home/pycharm/jsf_acceptance_test/output.xml
Log: /home/pycharm/jsf_acceptance_test/log.html
Report: /home/pycharm/jsf_acceptance_test/report.html
不知道如何最好地解决这个问题 - 我对机器人框架相对较新,并且发现很难在文档中找到答案。有人对此有任何想法吗?如果您需要,我很乐意用更多信息更新问题。干杯。
【问题讨论】:
标签: python return keyword robotframework tsv