DataDriver powered test returns "Test cannot be empty" error

Hi folks,

I’m trying to implement a simple test, powered by DataDriver. Just to open the browser and load url, defined in csv file. DataDriver seems to be installed, the file is read, but test returns “Test cannot be empty” error and it looks as if the ${url} and ${browserName} vars are not read/filled from the csv file? Any idea what could be wrong? Here is a screenshot, where you can see the structure of test, csv file and the errors I’m getting…

Thanks for any hint or suggestion.

Hi Pavel,

Looking at Structure of Test Suite and DataDriven Tests, it looks like you should change this line

Login with browser    ${url}    ${browserName}

to something like this, i.e. use default values for the keyword arguments rather than the variable names

Login with browser    http://no.set    NoBrowser

I believe the values you put here don’t matter they don’t get used, there get replaced by the values from the CSV, but they might get used as default values if there is no value for that variable in the csv file (doesn’t apply in your case)

Apart from this it looks like you did everything else the same as the documentation :+1:

Dave.

Hi Dave,

Thank you for the reply and suggestion. I tried that too but no change. It still complains about empty test?..

Hi Pavel,

Is there a line 15 to OpenBrowser.robot? try adding an empty line to the end of that file.

Dave.

Hi,

Seems really strange regarding the content and that all seems set properly (template, csv…)
Only difference I see with the examples is that your test doesn’t rely on a suite/test setup to open the browser, the template contains it.

As the Datadriver built itself cases based on the first csv column, maybe there’s a conflict with the *** Test cases *** first “Login with browser” line and arguments, as the error states “Unassigned required variable”. Maybe it tries to use this line and replace url.

Seems an odd proposition, but can you try removing the line in this section or comment it (empty Test cases section), and run the test?

Regards

Charlie

Hi Dave and Charlie,

Thank you both for your suggestions. I will try them first thing Monday morning :wink: I personally think there is something wrong with the DataDriver or RoboCode integration into VSCode. I will also try the RF & DataDriver integration into PyCharm IDE. Just in case.

Hi Guys,

Well well… I’ve been seeking a little bit, as it seemed really odd to me.

I reproduced your setup and indeed had the same problem.

@damies13, the added line didn’t help, not much as my own idea that led to not be able to run the test from the .robot file :sweat_smile: don’t know what was I thinking…

Tried to run from the suite, modified Test Cases arguments to Default, UserData has in their examples.

None worked, and I finally remembered the example .csv files they gave, so here’s a working one :

No need to play spot the difference, the twist is .csv file is separated with semicolon “;” instead of comma as in your file.

Default behavior seems to be to use the semicolon, but hopefully you don’t have to search-replace tons of .csv, and just add the dialect modifier and delimiter in the library call :

Library    DataDriver    file=parameters.csv    dialect=UserDefined    delimiter=,

More infos in this part :

Regards.
Charlie

2 Likes

Oh great find! Thank you for your investigation! I saw in one example, that someone was using semicolon, instead of comma as a separator. But I did not consider it critical. And why would I? Not to mention CSV stands for comma-separated values :grin: Once again, thank you for your help!

1 Like

Well done Charlie (@CharlieScene) :+1: :+1: :+1:

That was not obvious at all. I too would have expected the delimiter to default to comma with a file extension csv.

Dave.

Just a curiosity about commas versus semi-columns separators.
In many countries, not influenced by the British Empire, we use a comma as a decimal separator (not the dot), and we actually use the comma as the thousands separator. Of course, we prefer to use the semi-column in CSV files. :slight_smile:

I “think” :tm: that the only “old” European country that uses dot as decimal separator, is The Netherlands.

Actually most countries influenced by the British Empire used commas for a thousand delimiter.

rfc4180 caters for this with:

Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.

Since the .csv file extension is a defined standard for comma separated values format (CSV), the default behaviour should be to delimit on commas, but still retain the ability to specify a different delimiter as it seems to be a common practice to use non-standard delimiters in csv files.

My personal preference is to use tab separated values, because it’s easier to paste the data in to / out of a spreadsheet, and makes it easier to generate a large data sheet of generated values (for performance testing of course), but I always name these files with .tsv (to make it clear what they are)

So if you are using semi-columns separators, should the file extension should be .ssv?

But if you really want to avoid quoted strings you could always use HL7 V2 (pipe delimiters) …waits for the screams from the robot framework maintainers :rofl:

I guess that’s why people prefer to use JSON and YAML now days.

Dave.

1 Like

Hi guys,

Believe or not, there actually is an information about semicolon in the DataDriver user guide…


I’ve read the user guide several times, but apparently I missed this little detail. Not to mention that almost all DataDriver examples I found, used comma separated values :smile:

I’m using US regional settings and I’ve never ever noticed semicolons in any of the CSVs I ever used. I definitely think that DataDriver should use comma as default.

Anyway, thank you both for your help and especially Charlie, who found the solution :smile:

4 Likes