RobotFramework: Maximum limit of started keywords exceeded

bsferreira picture bsferreira · Aug 17, 2014 · Viewed 10.6k times · Source

I'm new to RobotFramework and I'm trying to do a simple test. Print an "Hello world" using Log keyword and get a value from a java class (I'm using jybot on Ride):

*** Settings ***
Library           robot.MyTest

*** Test Cases ***
Test1
    Log    Hello World    INFO
    Get Value

*** Keywords ***
Get Value
    Get Value

But when I run it, the test won't pass and it will give me this error:

Starting test: MyTest.Test1
20140817 01:00:15.683 :  INFO : Hello world
20140817 01:00:15.798 :  FAIL : Maximum limit of started keywords exceeded.
Ending test:   MyTest.Test1

I've searched about it but I still have no clue on this.

Answer

Bryan Oakley picture Bryan Oakley · Aug 17, 2014

Your test calls the keyword Get Value, which calls the keyword Get Value. You've created an infinite recursion. Get Value calls Get Value which calls Get Value which calls Get Value which calls ...

The best solution is the simplest one: don't create a keyword that calls itself. If there is already a keyword with a given name, don't create another one with the same name. While you can make it work having two with the same name, it will make your test cases harder to understand.

If you have another keyword called Get Value and you simply must have two keywords with the same name, you can give the fully qualified name so robot doesn't call the same keyword again. For example, if your Get Value is trying to call the Get Value from robot.myTest, call it like this:

*** Keywords ***
Get Value
    robot.myTest.Get Value