Getting error "Calling method '_start_suite' of listener 'DataDriver' failed: FileNotFoundError: File attribute was empty""

Getting error as " Calling method ‘_start_suite’ of listener ‘DataDriver’ failed: FileNotFoundError: File attribute was not a full path."

Code:-

*** Settings ***
Library SeleniumLibrary
Library Collections
Test Template Fill the login form
Library DataDriver file=xyz/Resource/data.csv

*** Variables ***
${url} https://demoqa.com/
${browser} chrome

*** Test Cases ***
Execute Login test with user ${username} and password as ${password}

*** Keywords ***

Fill the login form
[Arguments] ${username} ${password}

open browser        ${url}      ${browser}
maximize browser window
sleep    3s 

Appreciate quick help. Thanks

So, the relative path you pass to the reader as “file” is not being able to be located in the form you are passing it …

When in doupt: use absolute paths - even if you would dynamically construct it …

Thanks for your quick reply. Unfortunately tried couple of the options per suggestion but still getting same error. :frowning:

Tried Option 1:-
Tried by providing absolute path (detailed path of data.csv) as parameter,
Library DataDriver File=C:\Users\abc\PycharmProjects\pavan\xyz\Resource\data.csv

Tried Option 2:-
Tried by providing absolute path (detailed path of data.csv) as parameter,
Library DataDriver File=C:/Users/abc/PycharmProjects/pavan/xyz\Resource/data.csv

Tried Option 3:-
Tried by providing absolute path (detailed path of data.csv) as parameter,
Library DataDriver File=data.csv

Complete Error:

==============================================================================
ParamterizationTestViaCSVFIle

[ ERROR ] [ DataDriver ] Error in robot file:
File “C:\Users\abc\PycharmProjects\pavan\xyz\ParamterizationTestViaCSVFIle.robot”, line 0
[ ERROR ] Calling method ‘_start_suite’ of listener ‘DataDriver’ failed: FileNotFoundError: File attribute was empty. Tried to find C:\Users\abc\Pych
armProjects\pavan\xyz\ParamterizationTestViaCSVFIle.csv but file does not exist. If no file validation is required, set file_search_strategy=None.

Really appreciate your help!!!

Double-check the paths.

Thanks Hélio Guilherme for reply.

That’s the point. I am asking DataDriver to pick “data.csv” file from mentioned location.
ParamterizationTestViaCSVFIle.robot file which uses DataDriver Library to take data.csv inputs.

Si am surprised why it is looking for ParamterizationTestViaCSVFIle.CSV file instead for data.csv file?

Hi @Arvind,

Ah the joys of windows paths :rage:

I’ve seen python (and therefore robot framework) sometimes give weird intermittent file not found errors when combining paths with slashes going in different directions, which might be what you are getting here.

You gave the relative path of xyz/Resource/data.csv, but since it’s a relative path robot’s going to prefix the first part C:\Users\abc\PycharmProjects\pavan\? and you’ll end up with a path that looks like C:\Users\abc\PycharmProjects\pavan\xyz/Resource/data.csv which causes weird errors when python passes it to the windows system api.

A simple fix would be to use “windows” slashes (remember you need to escape them though:

Library DataDriver file=xyz\\Resource\\data.csv

but if you are hoping to run this test on a mixed environment that might break the tests on MacOS, Linux, etc, in which case using the path seperator from Operating-system variables might be a good idea:

Library DataDriver file=xyz${/}Resource${/}data.csv

The other option is just to use an absolute path with all the slashes going the same way (again this might be an issue if you need to run the test on multiple platforms)

Library DataDriver file=C:/Users/abc/PycharmProjects/pavan/xyz/Resource/data.csv

Hope this helps,

Dave.

Hi Dave,

Thanks a lot for detailed explanation and possible solution.
I tried with windows slashes (“\”) and now partially it works for me. Now robot framework/DataDriver looking for “data.csv” file at expected location.

However, now facing new issue as unable to fetch values from data.csv file and hence throwing error as “Variable ‘${username}’ not found.”.

In actual, there are 3 columns along with data in data.csv file as below,
Test Cases,${username},${password}
invalid username,abc,DGTO12
invalid password,xyz,ABRE334

Not sure why this error is thrown now :frowning:

I recreated your robot file and data.csv file and I get the same error “Variable ‘${username}’ not found.”, I don’t know enough about DataDriver (I only just installed it to try and help you) I tried to follow the documentation to figure out what was wrong but I’m not sure

robot Arvind.robot
==============================================================================
Arvind                                                                        
==============================================================================
invalid username,"abc","DGTO12"                                       | FAIL |
Variable '${username}' not found.
------------------------------------------------------------------------------
invalid password,"xyz","ABRE334"                                      | FAIL |
Variable '${username}' not found.
------------------------------------------------------------------------------
Arvind                                                                | FAIL |
2 tests, 0 passed, 2 failed
==============================================================================

Clearly it’s picking up the variables from the file, but it seems the variables are not being created.

To try things out I created another keyword to use as the Test Template:

Fill the login webform
	${vars}= 	Get Variables
	Log 	${vars}
	Log		${username} | ${password}

when I looked into ${vars}, there was no ${username} or ${password} variable. so maybe there is a bug in the newest version of DataDriver?

Dave.

1 Like

Thanks again Dave.
I am not sure if this could be issue from DataDriver library or not.

@Someone from RobotFramework Responsible Forum, Please advise/help.

Since your data.csv is using , as a separator, you should pass dialect=excel to DataDriver in the Library line

2 Likes

Hi Jani,

Many thanks for your perfect solution.

Its working fine now:)
Appreciate your help and prompt response.
Have a nice day…!!!