*** Settings ***
Documentation    Smoke tests for tool runtime core
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_tool_runtime.py

*** Test Cases ***
Tool Registry Register And Retrieve
    [Documentation]    Register a tool and retrieve it by name
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    register    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    registry-ok

Tool Runner Execute Lifecycle
    [Documentation]    Run a tool through the full lifecycle
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    lifecycle    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    lifecycle-ok

Tool Error Normalisation
    [Documentation]    Handler errors are normalised into ToolResult
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    error    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    error-ok
