Robot Framework - using User Libraries

可紊 提交于 2019-12-12 16:28:31

问题


i am facing difficulty when trying to run my tests. Here is what i did :

  1. Create a java project with one class which has one method called hello(String name)
  2. Exported this as a jar and kept it in the same directory where i keep my test case file.
  3. 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 World

      • Keyword * * 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!