Python robot框架在静态API中运行方法后如何获得结果

Python robot框架在静态API中运行方法后如何获得结果,python,return,keyword,robotframework,tsv,Python,Return,Keyword,Robotframework,Tsv,下面是我在测试用例和套件(\uuuu init\uuuuuu.txt)文件中引用的resource.txt。我希望在执行映射到静态API(RobotLibrary)的关键字后得到结果,然后将结果传递回相同的静态API(RobotLibrary)模块以断言结果。我试图将结果保存为RobotLibrary中的状态,但这不起作用,可能是因为RobotLibrary是跨多个测试的单个实例?我不介意通过关键字返回结果,并将它们作为参数返回给后续调用 *** Settings *** Library

下面是我在测试用例和套件(
\uuuu init\uuuuuu.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

不确定如何最好地进行这项工作-我对robot框架相对较新,并且发现很难在文档中找到这方面的答案。有人对此有什么想法吗?如果你需要的话,我很乐意用更多的信息来更新这个问题。干杯。

您的测试显示此错误:

No keyword with name '${result_run}= start journey with config' found.
这意味着robot测试运行程序在需要关键字的地方遇到了完整的字符串。这可能是因为在
=
开始旅程…
之间似乎只有一个空格。尝试添加另一个空格,以便变量和关键字位于测试用例表中两个单独的单元格中

${result_run}=  start journey with config
#             ^^ two spaces
如果切换到使用管道分隔格式,这些类型的问题将更容易发现