How to import custom keywords and variables using RIDE

1,165 views
Skip to first unread message

N.T.

unread,
May 22, 2015, 4:34:34 AM5/22/15
to robotframe...@googlegroups.com
Hello,

I'm trying to do a set of scripts where a test cases pulls the keywords and variables from resource files, which are placed in different folders. 

So there are 3 folders
-Test cases
-Variable files
-Keyword files

All 3 folders are in the same directory, and for one test case to access the variable files in the second they need to use the path: ../keywords/keyword.txt

Simply adding the path from RIDE causes a warning, and it looks like my test case cannot import it because using it on the test case doesn't highlight on ride.

This is the log:

20150522 15:30:21.439 [INFO]: Started RIDE 1.2.3 using python version 2.7.9 with wx version 2.8.12.1 in win32.


20150522 15:52:20.996 [WARN]: Importing test library "Customer Registration" failed


Traceback (most recent call last):
Importing test library 'CustomerRegistration' failed: ImportError: No module named CustomerRegistration
Traceback (most recent call last):
 
None
PYTHONPATH
:
  C
:\Python27\lib\site-packages\robotide\lib\robot\libraries
  C
:\Python27\lib\site-packages\robotide\lib
  C
:\Python27\lib\site-packages\wx-2.8-msw-unicode
  C
:\Python27\lib\site-packages\wx-2.8-msw-unicode
  C
:\windows\system32\python27.zip
  C
:\Python27\DLLs
  C
:\Python27\lib
  C
:\Python27\lib\plat-win
  C
:\Python27\lib\lib-tk
  C
:\Python27
  C
:\Python27\lib\site-packages
 
.
  C
:\windows\system32
  C
:\Python27\lib\site-packages\robotide\spec
 
File "C:\Python27\lib\site-packages\robotide\spec\librarymanager.py", line 76, in _fetch_keywords
   
return get_import_result(path, library_args)
 
File "C:\Python27\lib\site-packages\robotide\spec\libraryfetcher.py", line 20, in get_import_result
    lib
= TestLibrary(path, args)
 
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 37, in TestLibrary
    libcode
= importer.import_class_or_module(name)
 
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 64, in import_class_or_module
   
self._raise_import_failed(name, err)
 
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 102, in _raise_import_failed
   
raise DataError('\n'.join(msg))

Am not sure how else I'm supposed to set it. Is it that Robot Framework does not accept custom libraries? I partially find that hard to believe.





Tatu Aalto

unread,
May 23, 2015, 6:29:31 AM5/23/15
to Nicole Toledo, robotframework-users

Ugh

The error means that CustomRegistration library import did fail. I would assume, based on the error text, that you did import the library with object name and did not provide a path to the library. Because the library is not found from the PYTHON_PATH you will get the error. Adjusting your PYTHON_PATH or providing path to your library should fix the problem. More details can be found from user guide [1].

-Tatu
Send from my mobile
[1] http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#taking-test-libraries-into-use

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

N.T.

unread,
May 26, 2015, 12:38:58 AM5/26/15
to robotframe...@googlegroups.com, n.to...@iuj.jp
Hi Tatu,

Thanks for your help. I found out the reason for the import fail was because resource Libraries are not supposed to have a test suite, which is why it was failing. This was a mistake on my part.

I've removed the test suite and now it's running. The path seems to be okay since my test cases are running smoothly now. 
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages