How to get current test case(s) status pass/failed in Robot Framework
<p>I have used ${TEST STATUS} (Automatic variable) for getting the status giving error.</p>

<p>you can use that variable only in <strong>teardown</strong> section. like below example. robot is maintaining two levels "test levels" and "suit levels". inside test level there is another two things called "setup" and "teardown". <strong>setup</strong> means before executing every testcase it will run. and <strong>teardown</strong> means after executing every testcase it will run. In below example before executing Default_values, Overridden setup, No_teardown,etc. testcases Open_Application will run and after exiting the testcases Close Application will run. you can use that automatic variable in the tear down section only as described in docs and demonstated in the No_teardown testcase. In the No_teardown testcase it is checking whether it is true or not. you can change anything according to your need.</p>

<pre><code>*** Settings ***
Test Setup       Open Application    App A
Test Teardown    Close Application

*** Test Cases ***
Default values
    [Documentation]    Setup and teardown from setting table
    Do Something

Overridden setup
    [Documentation]    Own setup, teardown from setting table
    [Setup]    Open Application    App B
    Do Something

No teardown
    [Documentation]    Default setup, no teardown at all
    Do Something
    [Teardown]    Should Be True      '${TEST STATUS}' == 'True'

No teardown 2
    [Documentation]    Setup and teardown can be disabled also with special value NONE
    Do Something
    [Teardown]    NONE

Using variables
    [Documentation]    Setup and teardown specified using variables
    [Setup]    ${SETUP}
    Do Something
    [Teardown]    ${TEARDOWN}
</code></pre>

<p>This example is modified version of this robot docs link:-
<a href="http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-setup-and-teardown." rel="nofollow">http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-setup-and-teardown</a></p>

<p>Hope this will remove your doubts.</p>

python python-2.7 robotframework