weixin_39747383 2020-11-19 12:25
浏览 1

RIDE crashes if parsed user keywords contain invalid data

Originally submitted to Google Code by c.martin.taylor on 4 May 2009

See the attached RF project in ZIPped format. I created this trivial test suite, test and resource file all with RIDE, based on the testcase_template.tsv that comes with Robot Framework. RIDE lets you create and save the Resource file using File-->New Resource but when you try to import the resource file from the test file, or even just open the resource file in RIDE, you get the following:

Traceback (most recent call last): File "C:\Python25\Lib\site-packages\robotide\editors\editors.py", line 30, in wrapped method(self, event) File "C:\Python25\Lib\site-packages\robotide\editors\editors.py", line 492, in OnNewResource self.showimporteditordialog('Resource', ResourceImportDialogEditor) File "C:\Python25\Lib\site-packages\robotide\editors\editors.py", line 502, in showimporteditordialog item = self.data.newimport(type, name, dlg.getvalue()) File "C:\Python25\Lib\site-packages\robotide\model\lists.py", line 70, in newimport context.APP.openresource(respath) File "C:\Python25\Lib\site-packages\robotide\layout\application.py", line 39, in openresource resources = self.model.openresource(path) File "C:\Python25\Lib\site-packages\robotide\model\datamodel.py", line 47, in openresource resource = ResourceFile(path) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 60, in ResourceFile return ResourceFile(data) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 371, in init _AbstractDataFile.init(self, data) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 76, in init self.keywords = _UserKeywordList(self, data.userkeywords) File "C:\Python25\Lib\site-packages\robotide\model\lists.py", line 33, in init self.parsedata(data) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 536, in parsedata self.append(UserKeyword(self.parent, kw)) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 465, in init ComplexData.init(self, suite, ukdata, name) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 400, in init self.parsedata(data) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 480, in _parsedata self.parsesettings(data) File "C:\Python25\Lib\site-packages\robotide\model\model.py", line 485, in parsesettings self.settings['Arguments'] = Arguments(self, data.args, data.defaults, data.varargs) AttributeError: UserErrorHandler instance has no attribute 'args'

If you remove the Resource ~Resources/MyKeywords.tsv line from RIDEBug_Test.tsv then you can open the project OK in RIDE. As soon as this line is added back, you get the errors listed above.

This bug also happens if you generate a .html resource file instead of a .tsv resource file.

  • 写回答

7条回答 默认 最新

  • weixin_39747383 2020-11-19 12:25
    关注

    Originally submitted to Google Code by c.martin.taylor on 6 May 2009

    I found that the real source of this bug is the way I expressed the arguments to the keyword in the resource file. I did it like:

    My User Keyword | [Arguments] | Arg1 | Arg2 |

    where the correct notation is:

    My User Keyword | [Arguments] | ${Arg1} | ${Arg2} |

    With this fix to the resource file it opens OK with RIDE.

    BUT I still think this is a bug in the way it is (NOT) handled. The failure looks much more drastic than the simple error that caused it. A suitable error message to tell the user about the mistake would be much more useful.

    评论

报告相同问题?