问题
i am facing difficulty when trying to run my tests. Here is what i did :
- Create a java project with one class which has one method called hello(String name)
- Exported this as a jar and kept it in the same directory where i keep my test case file.
my Test case looks like this.
Setting * * Value * * Value * * Value * * Value * * Value *
Library MyLibrary
Variable * * Value * * Value * * Value * * Value * * Value *
Test Case * * Action * * Argument * * Argument * * Argument * * Argument * MyTest
hello WorldKeyword * * Action * * Argument * * Argument * * Argument * * Argument *
I always get the following error :
Error in file 'C:\Users\yahiya\Desktop\robot-practice\testcase_template.tsv' in table 'Setting': Importing test library 'MyLibrary' failed: ImportError: No module named MyLibrary
I have configured Pythopath in the system variables in my windows machine.
Please let me know what am i doing wrong here.
Thanks
回答1:
Try to put your Library into this folder:
...YourPythonFolder\Lib\site-packages\
or, if this doesn't work, make in the folder "site-packages" folder with the name "MyLibrary" and put your library there.
This should work.
回答2:
There might a problem with how you import your library. I don't have much experience with Java libraries but you need to provide the whole name, including the package name, when importing a library.
Read more in the guide.
来源:https://stackoverflow.com/questions/13357227/robot-framework-using-user-libraries