Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robot framework "resource file not found" error

I have designed this architecture where all the test cases will be in Amazon.robot file and all low level keywords for robot framework will be in two separate files(AmazonGui.robot and Commons.robot)

Amazon.robot file that has all the test cases:

*** Settings ***
Documentation  This is some basic infor the whole suite
Resource  Resources/AmazonGui.robot
Resource  Resources/Common.robot

*** Variables ***


*** Test Cases ***
User must sign in to check out

    [Documentation]  This is some basic info about test
    [Tags]  Smoke

    Common.Begin Web Test
    AmazonGui.Search for Products
    AmazonGui.Select Product from Search Results
    AmazonGui.Add Product to Cart
    AmazonGui.Begin Checkout
    Common.End Web Test

I have two other resources files that has the low keywords, so basically the test case(Amazon.robot) is calling the low level Keywords files(Common.robot and AmazonGui.robot). I have imported the Resources files to the test case file.


AmazonGui.robot file that has low level keywords for test cases

*** Settings ***
Library   Selenium2Library

*** Keywords ***

Search for Products
    go to  http://www.amazon.com
    wait until page contains  Your Amazon.com
    input text  id=twotabsearchtextbox  Ferrari 458
    click button    xpath=//*[@id='nav-search']/form/div[2]/div/input
    wait until page contains    results for "Ferrari 458"

Select Product from Search Results
    click link    css=#result_0 a.s-access-detail-page
    wait until page contains    Back to search results

Add Product to Cart
    click button    id=add-to-cart-button
    wait until page contains    Added to Cart

Begin Checkout
    click link    id=hlb-ptc-btn-native
    page should contain element    id=signInSubmit

Common.robot file that has common features just opening and closing browser

*** Settings ***
Library  Selenium2Library

*** Keywords ***

Begin Web Test
     open browser  about:blank  ff


End Web Test
     close browser

When I am trying to run the script from terminal using :

C:\development\robot-scripts\amazon>pybot -d results tests/amazon.robot

I get the below error:

[ ERROR ] Error in file 'C:\development\robot-scripts\amazon\tests\amazon.robot': Resource file 'Resources\AmazonGui.robot' does not exist.
[ ERROR ] Error in file 'C:\development\robot-scripts\amazon\tests\amazon.robot': Resource file 'Resources\Common.robot' does not exist.
==============================================================================
Amazon :: This is some basic infor the whole suite
==============================================================================
User must sign in to check out :: This is some basic info about test  | FAIL |
No keyword with name 'Common.Begin Web Test' found.
--------------------------------------------------------
Amazon :: This is some basic infor the whole suite                    | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed

Not really sure, where I should look to find out the issue.

Robot framework error

like image 990
rrene Avatar asked Sep 11 '26 06:09

rrene


1 Answers

You have your test cases inside a folder called tests. The Resource files are present in a different folder called Resources.

When you give

Resources/AmazonGui.robot

It will check for a directory named Resources in the directory tests, but actually the directory is present outside the tests directory.

../Resources/AmazonGui.robot

Here you are asking the framework to come outside of the tests directory and check for the directory named Resources.

like image 181
Radhakrishna Pemmasani Avatar answered Sep 15 '26 10:09

Radhakrishna Pemmasani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!