Closed tibitTW closed 7 months ago
Have you imported your library twice? Or is there another library with the same keyword?
The keyword that is found multiple times is HERO6: Connect
and not My Keyword
, in which line does the error occur?
Sorry for my mistake, it's should be the below code.
*** Settings ***
Resource ../../../Keywords/Main.robot
Suite Setup Run Keywords
... Set Library Search Order MASTER AND
... HERO6: Connect
This problem is happened on HERO6: Connect
, and the resource file Main.robot
import 2 times of my module indeed (like the below code):
Library path.to.my.module.HERO6Client WITH NAME MASTER
Library path.to.my.module.HERO6Client WITH NAME SLAVE
I want to ensure that would I get these warning if I already use the keyword Set Library Search Order
to specify the keyword I want? Is it expected behavior or not?
ok, I understand, unfortunately RobotCode does not support Set Library Search Order
, as this can only be evaluated dynamically at runtime. However, RobotCode only performs a static analysis.
A workaround is, and because it is actually more readable, simply put the namespace in front of the keyword:
*** Settings ***
Library path.to.my.module.HERO6Client WITH NAME MASTER
Library path.to.my.module.HERO6Client WITH NAME SLAVE
Suite Setup MASTER.HERO6: Connect
You can also replace the WITH NAME
with AS
, WITH NAME
is deprecated and will be removed in one of the next RobotFramework versions.
*** Settings ***
Library path.to.my.module.HERO6Client AS MASTER
Library path.to.my.module.HERO6Client AS SLAVE
Suite Setup MASTER.HERO6: Connect
If you do not want this, you can also simply hide the error by telling RobotCode to ignore this error.
*** Settings ***
Resource ../../../Keywords/Main.robot
Suite Setup Run Keywords
... Set Library Search Order MASTER AND
... HERO6: Connect # robotcode: ignore
Simply add # robotcode: ignore
ignore in the line where the error occurs as a comment.
OK, I'll give it a try, thanks alot!!
Please describe. I have a robot suite and the
Suite Setup
looks like this:The "My Keyword" is from module I wrote and puts in workspace folder, and it keeps highlighted with error:
Below is RobotCode settings in
settings.json
, and I pretty sure RobotCode extension can load my module, since I can track keyword in my robot suite withcmd + click
I'm not sure if this is an issue of RobotCode or vscode, is there any solution?
Desktop (please complete the following information):