Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop test execution in Robot Framework through keywords implemented with Java?

I have a keyword implemented with Java and if keyword fails i need to stop the whole test execution with message: "ERROR: example message".

like image 636
PavloSI Avatar asked Nov 03 '22 21:11

PavloSI


1 Answers

Raising exceptions is the officially recommended way.

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#reporting-keyword-status

Java (as there in the comment to accepted answer)

throw new AssertionError("ERROR: example message")

Python

from exceptions import AssertionError
.
.
.
 def rftest(self):
   test_result = lib.runtest()
   if (0 != test_result ):
          raise AssertionError("Test Failed")
like image 103
binithb Avatar answered Nov 12 '22 15:11

binithb