test-fullautomation / robotframework

Generic automation framework for acceptance testing and RPA
http://robotframework.org
Apache License 2.0
1 stars 0 forks source link

threading: payload get sometimes lost #47

Closed test-fullautomation closed 7 months ago

test-fullautomation commented 1 year ago

Below code sample end sometimes passed, sometimes failed if multiple times executed. Reason is sporadically missing payload:

*** Settings ***
Library    Collections
Library    String

*** Keywords ***

#
#    Threading payload base keywords
#
################################################################################
threading_payload_base.thread1
    Log    entering thrd1    console=True
    ${payload} =    Evaluate    {'CLIENT':{'NAME':'NAME','ID':1},'SERVER': {'ID':2,'IP':'172.17.0.4','PORT':'12345'},'SERVICE':{'ID':'ECHOSERVICE'}}
    #Sleep    0.25
    Send Thread Notification    threading_payload_base.thread1_finished    ${payload}

*** Test Cases ***
Threading Payload Base

    THREAD    TEST_THREAD1    False
        threading_payload_base.thread1
    END

    ${payload}=    Evaluate    {}
    ${payload}=    Wait Thread Notification    threading_payload_base.thread1_finished    10
    Log    wait thread successfully passed    console=True
    Log    payload is: '${payload}''    console=True
    Should Be Equal    ${payload}[SERVER][ID]    ${2}

Result:

POL2HI@HI-C-002Y9 MINGW64 /c/RobotTest/testcases
$  cd C:\\RobotTest\\testcases ; /usr/bin/env C:\\Users\\pol2hi\\AppData\\Local\\Temp\\rf-ls-run\\run_env_00_54f4q5k9.bat -u c:\\Program\ Files\\RobotFramework\\robotvscode\\data\\extensions\\robocorp.robotframework-lsp-1.11.0\\src\\robotframework_debug_adapter\\run_robot__main__.py --port 49236 --no-debug -T -d C:\\RobotTest\\testcases\\..\\logfiles -b debug\\hanging_thread.log -l htmllog\\hanging_thread_log.html -o xmloutput\\hanging_thread_output.xml -r htmlreport\\hanging_thread_report.html c:\\RobotTest\\testcases\\hanging_thread.robot 
==============================================================================
Hanging Thread
==============================================================================
Threading Payload Base                                                entering thrd1
.wait thread successfully passed
.payload is: '{}''
Threading Payload Base                                                | UNKNOWN |
Dictionary '${payload}' has no key 'SERVER'.
------------------------------------------------------------------------------
Hanging Thread                                                        | UNKNOWN |
1 test, 0 passed, 0 failed, 1 unknown
==============================================================================
Debug:   C:\RobotTest\logfiles\debug\hanging_thread-20231108-165316.log
Output:  C:\RobotTest\logfiles\xmloutput\hanging_thread_output-20231108-165316.xml
Log:     C:\RobotTest\logfiles\htmllog\hanging_thread_log-20231108-165316.html
Report:  C:\RobotTest\logfiles\htmlreport\hanging_thread_report-20231108-165316.html

POL2HI@HI-C-002Y9 MINGW64 /c/RobotTest/testcases
$  cd C:\\RobotTest\\testcases ; /usr/bin/env C:\\Users\\pol2hi\\AppData\\Local\\Temp\\rf-ls-run\\run_env_00_5sv32r0x.bat -u c:\\Program\ Files\\RobotFramework\\robotvscode\\data\\extensions\\robocorp.robotframework-lsp-1.11.0\\src\\robotframework_debug_adapter\\run_robot__main__.py --port 49239 --no-debug -T -d C:\\RobotTest\\testcases\\..\\logfiles -b debug\\hanging_thread.log -l htmllog\\hanging_thread_log.html -o xmloutput\\hanging_thread_output.xml -r htmlreport\\hanging_thread_report.html c:\\RobotTest\\testcases\\hanging_thread.robot 
==============================================================================
Hanging Thread
==============================================================================
Threading Payload Base                                                entering thrd1
RFStream Warning: keyword - BuiltIn.Wait Thread Notification did not have a corresponding pop.
RFStream Warning: unable to pop keyword - BuiltIn.Wait Thread Notification because it does not match the current top: suite - s1
.wait thread successfully passed
.payload is: '{'CLIENT': {'NAME': 'NAME', 'ID': 1}, 'SERVER': {'ID': 2, 'IP': '172.17.0.4', 'PORT': '12345'}, 'SERVICE': {'ID': 'ECHOSERVICE'}}''
Threading Payload Base                                                | PASS |
------------------------------------------------------------------------------
Hanging Thread                                                        | PASS |
1 test, 1 passed, 0 failed, 0 unknown
==============================================================================
Debug:   C:\RobotTest\logfiles\debug\hanging_thread-20231108-165321.log
Output:  C:\RobotTest\logfiles\xmloutput\hanging_thread_output-20231108-165321.xml
Log:     C:\RobotTest\logfiles\htmllog\hanging_thread_log-20231108-165321.html
Report:  C:\RobotTest\logfiles\htmlreport\hanging_thread_report-20231108-165321.html

POL2HI@HI-C-002Y9 MINGW64 /c/RobotTest/testcases
milanac030988 commented 8 months ago

Maybe fixed by https://github.com/test-fullautomation/robotframework/pull/69 . Could not reproduce now.

test-fullautomation commented 7 months ago

integrated in RobotFramework AIO 0.11.0