我已经设法将ExcelRobot
库导入到 Ride 中,因为名称没有变红,所以一切看起来都很正常。
当我转到测试用例并调用关键字Open Excel
时,它显示关键字可用。
但是,当我运行测试用例时,我得到了错误Importing test library 'ExcelRobot' failed: ImportError: No module named ExcelRobot
有什么问题?
我不确定您要使用的库。但是我在我的测试套件中使用了“ExcelLibrary”并且它工作得很好。
示例代码:
*** Settings ***
Library ExcelLibrary
Library String
*** Variables ***
${ExcelLocation} ExcelTestNumbers.xls
${ExcelOutputLocation} ExcelTestNumbersOutput.xls
${ExcelSheetName} Sheet1
*** Test Cases ***
NumberRotation
NumberRotation
*** Keywords ***
NumberRotation
ExcelLibrary.Open Excel ${ExcelLocation}
${ExcelRowCount} ExcelLibrary.Get Row Count ${ExcelSheetName}
Log to console Excel_Row_Count_${ExcelRowCount}
: FOR ${LoopCycle} IN RANGE ${ExcelRowCount}
\ Log to console Loop_Rotation_${LoopCycle}
\ ${CurrentProcessingNumber}= ExcelLibrary.Read Cell Data By Coordinates ${ExcelSheetName} 0 ${LoopCycle}
\ Log to console CurrentProcessingNumber_${CurrentProcessingNumber}
\ ExcelLibrary.Put String to Cell ${ExcelSheetName} 1 ${LoopCycle} ExcelSave${LoopCycle}
\ Save Excel ${ExcelOutputLocation}
\ Log to console Saved
\ ... ELSE NumberInvalid
ExcelLibrary 关键字:http ://navinet.github.io/robotframework-excellibrary/ExcelLibrary-KeywordDocumentation.html
希望这可以帮助。
干杯。
RIDE 包含作为内部库的robotframework 3.1.2,因此它可以处理关键字文档,甚至可以在未安装robotframework 的系统中作为编辑器工作。此策略还允许在 Python 2.7 中安装 RIDE 1.7.4.2,但robot
在 Python 3 上安装运行。
您报告的错误将落在这种情况下,即正确检测到库导入,但不是在执行时。
RIDE 的 TestRunner(运行选项卡)准备执行参数robot
并调用它,就像从命令窗口、shell 或终端一样。PATH 环境变量找到的第robot
一个是运行的那个。
请参阅 Tools->RIDE 记录提及所robot
找到内容的行,以及 TestRunner 消息。