reportportal / agent-Python-RobotFramework

Robot Framework integration for Report Portal
Apache License 2.0
59 stars 32 forks source link

Client does not support Teardown in keyword #108

Closed rdagum closed 3 years ago

rdagum commented 3 years ago

I'm getting an error while processing the results of a robot framework execution. It look like Report Portal does not expect a keyword to have a [Teardown]. This is a sample code that causes the error:

*** Settings ***
Library    Browser
*** Test Cases ***
TC1
    [Setup]    Log    Suite Setup
    Kw With Teardown
    Log    Test Body
    [Teardown]    Log    Suite Teardown
*** Keywords ***
Kw With Teardown
    ${previous kw}=    Register Keyword To Run On Failure    NONE
    Log    Kw Body Start
    Fail   Fail Keyword
    [Teardown]    Register Keyword To Run On Failure    ${previous kw}

here's the call stack:

DEBUG:robotframework_reportportal.listener:ReportPortal - Start Keyword: {'type': 'Teardown', 'kwname': 'Register Keyword To Run On Failure', 'libname': 'Browser', 'doc': 'Sets the keyword to execute, when a Browser keyword fails.', 'args': ('${previous kw}',), 'assign': (), 'tags': ['Config'], 'starttime': '1621888645342'}
DEBUG:robotframework_reportportal.service:ReportPortal - Start keyword: request_body={'description': 'Sets the keyword to execute, when a Browser keyword fails.', 'has_stats': False, 'item_type': 'AFTER_KEYWORD', 'name': 'Browser.Register Keyword To Run On Failure (${previous kw})', 'parent_item_id': 'df699ca5-2c19-45a2-96f2-a1a7381c1b5f', 'start_time': '1621888645342'}
DEBUG:urllib3.connectionpool:http://192.168.28.31:8080 "POST /api/v2/sandbox/item/df699ca5-2c19-45a2-96f2-a1a7381c1b5f HTTP/1.1" 400 91
Traceback (most recent call last):
  File "C:\Python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "X:\Projects\hr_automation\.temp\pvenv\Scripts\post_report.exe\__main__.py", line 7, in <module>
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robotframework_reportportal\post_report.py", line 73, in main
    process(*values)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robotframework_reportportal\post_report.py", line 48, in process
    test_run.visit(RobotResultsVisitor())
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\result\executionresult.py", line 120, in visit
    visitor.visit_result(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\result\visitor.py", line 44, in visit_result
    result.suite.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\testsuite.py", line 226, in visit
    visitor.visit_suite(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 87, in visit_suite
    suite.suites.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\itemlist.py", line 77, in visit
    item.visit(visitor)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\testsuite.py", line 226, in visit
    visitor.visit_suite(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 87, in visit_suite
    suite.suites.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\itemlist.py", line 77, in visit
    item.visit(visitor)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\testsuite.py", line 226, in visit
    visitor.visit_suite(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 87, in visit_suite
    suite.suites.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\itemlist.py", line 77, in visit
    item.visit(visitor)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\testsuite.py", line 226, in visit
    visitor.visit_suite(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 88, in visit_suite
    suite.tests.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\itemlist.py", line 77, in visit
    item.visit(visitor)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\testcase.py", line 130, in visit
    visitor.visit_test(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 111, in visit_test
    test.body.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\itemlist.py", line 77, in visit
    item.visit(visitor)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\keyword.py", line 98, in visit
    visitor.visit_keyword(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 136, in visit_keyword
    kw.teardown.visit(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\keyword.py", line 98, in visit
    visitor.visit_keyword(self)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robot\model\visitor.py", line 133, in visit_keyword
    if self.start_keyword(kw) is not False:
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robotframework_reportportal\result_visitor.py", line 117, in start_keyword
    listener.start_keyword(kw.name, attrs, ts)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robotframework_reportportal\listener.py", line 224, in start_keyword
    kwd.rp_item_id = self.service.start_keyword(keyword=kwd, ts=ts)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\robotframework_reportportal\service.py", line 232, in start_keyword
    return self.rp.start_test_item(**start_rq)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\reportportal_client\service.py", line 366, in start_test_item
    item_id = _get_id(r)
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\reportportal_client\service.py", line 68, in _get_id
    return _get_data(response)["id"]
  File "x:\projects\hr_automation\.temp\pvenv\lib\site-packages\reportportal_client\service.py", line 100, in _get_data
    raise ResponseError(error_messages[0])
reportportal_client.errors.ResponseError: 4001: Incorrect Request. [Value is not allowed for field 'type'.]

I posted the question in slack in the general channel and this was the feedback: image

iivanou commented 3 years ago

@rdagum Robot framework version? reportportal-client version? robotframework-reportportal version? Can u attach the output.xml file so I can easily reproduce the issue? Thanks.

P.S. Please, use templates when creating a new issue. Templates help to add all the necessary information for a developer.

rdagum commented 3 years ago

I'll use template next time. Here's the info:

Python 3.8.2
reportportal-client              5.0.10
robotframework                   4.0.1
robotframework-reportportal      5.1.2

And the file output.zip