[1.1.4] IDE : Robotframework: Keyword Settings::Resouce missing --- upgraded to RFW 3.1 (build #191)

Asked by Melvin Raymond

-- SikulixIDE-1.1.4-SNAPSHOT
-- Python 2.7.10

I'm working with some Tutorial examples from this link:

https://blog.codecentric.de/en/2016/01/robot-framework-tutorial-2016-keywords/

So far I have gotten the SikuliX IDE with Robot Framework working with Keywords that are in the IDE; with this code:

runScript("""
robot
*** Settings ***

*** Test Cases ***
Test Robot Framework Logging
    Log Test Logging

Test Melvin makes his own keyword with an error
    Melvins error Logging | Melvin leaves a message ERROR

Test Melvin makes his own keyword with a warning
    Mevins warning Logging | Melvin leaves a message WARN

*** Keywords ***
Melvins error Logging
    [Arguments] ${msg} ${level}
    Log ${msg} ${level}

Mevins warning Logging
   [Arguments] ${msg} ${level}
   Log ${msg} ${level}

""")

The next code example in that link above shows making these Keywords external as a "Resource" file by turning the Keywords into a text file. However, I have not been able to get it to work, and don't know if it's a path problem, or something else? Anyway, here's the code they're using for this example:

runScript("""
robot
*** Settings ***
Resource resource-2.txt

*** Test Cases ***
Test Robot Framework Logging
    Log "Test Logging"

Test My Logging
    My Logging "Test My Logging 1" "Test My Logging 2"
""")

And the Keywords have been put in an external text file as such:

*** Keywords ***
My Logging
    [Arguments] @{arg}
    Log Many @{arg}

The code runs but the output Log report shows the following error:

Full Name: UsingResourcesExample.Test My Logging
Start / End / Elapsed: 20190205 08:32:42.719 / 20190205 08:32:42.734 / 00:00:00.015
Status: FAIL (critical)
Message: No keyword with name 'My Logging' found.
00:00:00.005KEYWORD My Logging "Test My Logging 1", "Test My Logging 2"
Start / End / Elapsed: 20190205 08:32:42.725 / 20190205 08:32:42.730 / 00:00:00.005
08:32:42.726 FAIL No keyword with name 'My Logging' found.

So far I've tried the following with the resource-2.txt file:
-- putting with at the same level in folder as <scriptname>.sikuli file as resource-2.txt and as resource-2.rtf
-- I've tried using "Get Info" and the "where" to get a direct path to the file and using that
-- I've created a "Resource" folder and put it under that and tried a direct path to it
-- I've put the file directly under the <scriptname>.sikuli.robot folder but it wipes the file out when saving whether I run the IDE script immediate or if I save and run it.

I've exhausted all I know about it at this point and could really use some help getting off the ground with this.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Melvin Raymond
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Uuups, sorry.

Did not look after the bundled RFW package for a longer time.

The bundled version is 3.0.4, but the Settings::Resource is only defined from version 3.1

The error message is somewhat misleading, since it allows to read, that the resource file is not found, but it really means, that the Resource keyword is not found ;-)

I will upgrade the bundled RFW to 3.1 the next days.
Until then keep your Resource definition in the script file.

Watch the related bug, to see, when it is fixed.

Revision history for this message
Melvin Raymond (fribian) said :
#2

OK, thanks RaiMan. It's a pretty complicated pile of stuff for me. I don't know how you do what you do.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

No problem.
Just wait until SikuliX uses RFW version 3.1.1

Revision history for this message
RaiMan (raimund-hocke) said :
#4

ok, just upgraded to RFW 3.1.1 with the latest build today (#191)

this worked:

# testRobot.sikuli
runScript("""
robot
*** Settings ***
Resource ../myResource.txt

*** Test Cases ***
Test Robot Framework Logging
    Log "Test Logging"

Test My Logging
    My Logging "Test My Logging 1" "Test My Logging 2"
""")

# myResource.txt
*** Keywords ***
My Logging
    [Arguments] @{arg}
    Log Many @{arg}

script and resource file are in the same folder.

This only works with saved script files (not with Untitled tab - no yet saved)!

BE AWARE: to fill the next column in a line, there must be at least 2 spaces in between (you only had one space)

Revision history for this message
Melvin Raymond (fribian) said :
#5

This seems to have solved the problem Raiman. I used the example out on the "Thomas Jaspers" robot-keyword-tutorial file labeled "sample-2-own-keyword-resource.txt" and "resouce-2.txt" file.

I saved the "resource-2.txt" file from Mojave by using the "Format > Make plain text" tab, from the TextEdit app. I don't know if this also had something to do with original posted issue (and your fix too) as I rarely save as ".txt" files and have just taken the ".rtf" default and renamed from the OS level. I wasn't sure if it was keeping the file as "resource-2.txt.rtf" or not but it looked like at the OS level it was giving me a choice to keep it ".rtf" or save it as ".txt".

Anyway, it is working now. Thanks very much for your help Raiman. Much appreciated.