问题是这样的,当我新建了resource文件后想导入并使用时出现了问题,导入的resource文件为红色,
查看ride log发现:
Traceback (most recent call last):
Importing test library 'C:UserssilentorDocumentsRF_testcasesTestResource01.robot' failed: Not a valid file or directory to import.
File "C:UserssilentorAppDataRoamingPythonPython38site-packages
obotidespeclibrarymanager.py", line 82, in _fetch_keywords
return get_import_result(path, library_args)
File "C:UserssilentorAppDataRoamingPythonPython38site-packages
obotidespeclibraryfetcher.py", line 21, in get_import_result
lib = robotapi.TestLibrary(path, args)
File "C:UserssilentorAppDataRoamingPythonPython38site-packages
obotidelib
obot
unning estlibraries.py", line 49, in TestLibrary
libcode, source = importer.import_class_or_module(import_name,
File "C:UserssilentorAppDataRoamingPythonPython38site-packages
obotidelib
obotutilsimporter.py", line 72, in import_class_or_module
self._raise_import_failed(name, err)
File "C:UserssilentorAppDataRoamingPythonPython38site-packages
obotidelib
obotutilsimporter.py", line 103, in _raise_import_failed
raise DataError(msg)
花了好长时间都没找到对应答案,最后在官方文档上看到最新的resource文件已经支持.resource格式,直接导入文件名即可使用,而我创建的扩展名为.robot,期间更改为.txt仍不行。
解决方法:创建资源文件时选择.resource格式,导入时使用资源名即可(默认资源与测试套件在相同文件夹下)