How to pass a variable from one testcase to another

Hi community!
I am trying to pass a variable from testcase 1 to testcase 2 using set global variable
but it is not working
this is how I do it
in test case one,I fetch my first variable which is my sales orde id
${orderID} Get Text //div[@name=‘TabHeaderGeneral_SalesTable_SalesId’]
that works fine!
Then I pass this variable to my Global variable using
${Global} Set Global Variable ${orderID}
so I have now created a global variable with the value ${orderID}

in test case 2
I am trying to call ${Global} and it is not working

Input Text (any xapth) ${Global}
error says ${Global} not found

Set Global Variable works differently. Syntax is the following:

Set Global Variable    name    value

So in your case it should be:

Set Global Variable    ${ORDER_ID}    ${orderID}

and later

Input Text    xpath=...    ${ORDER_ID}

Side-note: You should think twice before making one tests dependent on another.


Hi Aleh Borysiewicz,

Thank for your comment!
unfortunately that did not work neither

Without more details we are not able to help.

*** Test Cases ***
Test Case 1
    Set Global Variable    ${ORDER_ID}    123

Test Case 2
    Log To Console    ${ORDER_ID}


Test Case 1                                                           | PASS |
Test Case 2                                                           123
Test Case 2                                                           | PASS |
DemoGlobals                                                           | PASS |
2 tests, 2 passed, 0 failed

I found out ,what my mistake was
I was running every test case seperately instead of running the suite

Thanks very much for your help and support