# How to get ${KEYWORD STATUS} in robot framework

**URL:** <https://forum.robotframework.org/t/how-to-get-keyword-status-in-robot-framework/3702>\
**Category:** Robot Framework\
**Created:** [27 April 2022 12:01 UTC](https://forum.robotframework.org/t/how-to-get-keyword-status-in-robot-framework/3702 "2022-04-27T12:01:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [27 April 2022 12:01 UTC](https://forum.robotframework.org/t/how-to-get-keyword-status-in-robot-framework/3702/1 "2022-04-27T12:01:25Z")

</div>

Hi All,

I gone through robot guide. Found here-[Robot Framework User Guide](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html)

I have written below keyword and teardown-  
With Teardown  
Log To Console Logging message  
[Teardown] Log ${KEYWORD STATUS}

I want to get status every keyword at the end of keyword step execution.  
I tried to directly log this inside my keyword but getting error like-  
**Variable ‘${KEYWORD STATUS}’ not found.**

E.g. I have below keyword  
Create User  
_complete user creation  
IF “${KEYWORD\_STATUS}” == “FAIL”  
Log ${error\_text}  
Call API_

Above teardown I have to call it in every step . Is there way I can directly check If ${KEYWORD STATUS}==‘FAIL’ then call some api .

Does robot automatically calls above teardown after every keyword execution. Currently I have to explicitly make call to it

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [27 April 2022 13:27 UTC](https://forum.robotframework.org/t/how-to-get-keyword-status-in-robot-framework/3702/2 "2022-04-27T13:27:37Z")

</div>

Hi @bk-user,

Perhaps what you want is [Run Keyword And Return Status](https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Run%20Keyword%20And%20Return%20Status)

```python
${status}=	Run Keyword And Return Status	complete user creation
IF “${status}” == “FAIL”
	Log ${error_text}
	Call API

```

Dave.

---

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [27 April 2022 14:05 UTC](https://forum.robotframework.org/t/how-to-get-keyword-status-in-robot-framework/3702/3 "2022-04-27T14:05:31Z")

</div>

Thanks , Working @damies13.
