0
votes

I have managed to import the ExcelRobot library into Ride and everything look normal since the name didnt got in red. enter image description here

When I go to the Test Case and call the keyword Open Excel, it shows the keyword is available. enter image description here

However, when I ran the Test Case, I got the error Importing test library 'ExcelRobot' failed: ImportError: No module named ExcelRobot

What can be wrong?

2

2 Answers

3
votes

I'm not sure about the library that you are going to use. But I have used "ExcelLibrary" in my test suite and its perfectly working.

  1. Step 01: pip install robotframework-excellibrary
  2. Step 02: Check the library in your python path (Ex. C:\Python27\Lib\site-packages\ExcelLibrary)
  3. Step 03: Import the library in your test

Example code:

*** 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 Keywords: http://navinet.github.io/robotframework-excellibrary/ExcelLibrary-KeywordDocumentation.html

Hope this helps.

cheers.

2
votes

RIDE includes robotframework 3.1.2 as an internal library, so it can process the keywords documentation, and even do its job as an Editor in systems without robotframework installed. This strategy also allows to have RIDE 1.7.4.2 installed in Python 2.7 but run robot installed on Python 3.

The error you report, would fall on this scenario, where the library import is correctly detected, but not at execution time.

RIDE's TestRunner (the Run tab), prepares the execution arguments to robot and calls it, just like from a command window, shell or terminal. The first robot found by the PATH environment variable, is the one that is run.

See Tools->RIDE Log the line mentioning what robot was found, and also the TestRunner message.