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: nesting of THREAD BuiltIn not possible #46

Closed test-fullautomation closed 2 months ago

test-fullautomation commented 7 months ago

Flowing code doesn't work. I THREAD lines, "wait thread notification" and should be equal is commented the code runs 10 times.

*** 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
    WHILE    True    limit=10    on_limit_message=Limit reached

        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}

    END   

Result:

$  cd C:\\RobotTest\\testcases ; /usr/bin/env C:\\Users\\pol2hi\\AppData\\Local\\Temp\\rf-ls-run\\run_env_00_v_de7egy.bat -u c:\\Program\ Files\\RobotFramework\\robotvscode\\data\\extensions\\robocorp.robotframework-lsp-1.11.0\\src\\robotframework_debug_adapter\\run_robot__main__.py --port 49228 --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                                                | UNKNOWN |
No keyword with name 'THREAD' found.
------------------------------------------------------------------------------
Hanging Thread                                                        | UNKNOWN |
1 test, 0 passed, 0 failed, 1 unknown
==============================================================================
Debug:   C:\RobotTest\logfiles\debug\hanging_thread-20231108-165122.log
Output:  C:\RobotTest\logfiles\xmloutput\hanging_thread_output-20231108-165122.xml
Log:     C:\RobotTest\logfiles\htmllog\hanging_thread_log-20231108-165122.html
Report:  C:\RobotTest\logfiles\htmlreport\hanging_thread_report-20231108-165122.html
test-fullautomation commented 2 months ago

integrated in RobotFramework AIO 0.11.0