如何将SwingLibrary插件添加到RobotFramework?

时间:2014-03-06 15:16:18

标签: swing jython robotframework

我正在尝试执行https://github.com/robotframework/SwingLibrary/wiki/SwingLibrary-Demo

中提供的SwingLibrary演示

设置好后(Jython,RobotFramework,演示应用程序),我可以运行以下命令:

run_demo.py startapp

,它有效(演示应用启动)。

现在,如果我尝试运行样本测试,它就会失败:

run_demo.py example.txt

[ ERROR ] Error in file '/home/user1/python-scripts/gui_automation/sample-text.txt': Non-existing setting 'Library SwingLibrary'.
[ ERROR ] Error in file '/home/user1/python-scripts/gui_automation/sample-text.txt': Non-existing setting 'Suite Setup Start Test Application'.
==============================================================================
Sample-Text                                                                   
==============================================================================
Test Add Todo Item                                                    | FAIL |
No keyword with name 'Insert Into Text Field description ${arg}' found.
------------------------------------------------------------------------------
Test Delete Todo Item                                                 | FAIL |
No keyword with name 'Insert Into Text Field description ${arg}' found.
------------------------------------------------------------------------------
Sample-Text                                                           | FAIL |
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================
Output:  /home/user1/python-scripts/gui_automation/results/output.xml
Log:     /home/user1/python-scripts/gui_automation/results/log.html
Report:  /home/user1/python-scripts/gui_automation/results/report.html

我怀疑它找不到swinglibrary.jar,因此我的插件安装可能搞砸了。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

在报告中查看以下错误消息:

[ ERROR ] Error in file '...': Non-existing setting 'Library SwingLibrary'.
[ ERROR ] Error in file '...': Non-existing setting 'Suite Setup Start Test Application'.

调试的第一条规则是始终假设错误消息告诉你字面意义。

他们告诉你,你有一个未知的设置。它认为您正在使用名为“Library SwingLibrary”的设置和名为“Suite Setup Start Test”的设置。这些显然是不正确的设置名称。问题是,为什么这么说?

我的猜测是你使用的是以空格分隔的文本格式,而“Library”和“SwingLibrary”之间只有一个空格。因为有一个空格,机器人认为整行位于设置表的第一列,并且第一列中的任何内容都被视为设置名称。

修复应该像在“Library”之后插入两个或多个空格一样简单,在“Suite Setup”之后插入两个或多个空格。

这种类型的错误是我总是建议使用管道分隔格式的原因。它使单元格之间的界限更容易看到。