← Back to team overview

sikuli-driver team mailing list archive

[Question #678360]: Mojave : SikuliX IDE : How do I get Keywords in Resource files to work with robot framework

 

New question #678360 on Sikuli:
https://answers.launchpad.net/sikuli/+question/678360

-- 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. 

You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.