'Robotframework datadriver library not able to find a variable from CSV file

I have a problem while trying to set up datadriver library with robot framework. I get to error that one of the variables is not found.

CSV File:

${username},${password}
[email protected],adm
[email protected],admin
[email protected],adm

DDT2_csv.robot:

*** Settings ***
Library     SeleniumLibrary
Library     DataDriver  ../testdata/TestData.csv    delimiter=,     encoding=utf-8
Resource    ../resources/login_resources.robot
Suite Setup     login_resources.open my browser
Suite Teardown  login_resources.close browsers
Test Template   Invalid Login


*** Test Cases ***
Doing Test Credentials for ${username} and ${password}  Default    UserData

*** Keywords ***
Invalid Login 
    [Arguments]     ${username}     ${password}
    input email  ${username}
    input password  ${password}
    click login button
    error message should be visible 

I am getting the below error:

==============================================================================
DDT2 csv                                                                      
==============================================================================
Doing Test Credentials for ${username} and ${password}                | FAIL |
Variable '${username}' not found.
------------------------------------------------------------------------------
[ WARN ] Multiple test cases with name 'Doing Test Credentials for ${username} and ${password}' executed in test suite 'DDT2 csv'.
Doing Test Credentials for ${username} and ${password}                | FAIL |
Variable '${username}' not found.
------------------------------------------------------------------------------
[ WARN ] Multiple test cases with name 'Doing Test Credentials for ${username} and ${password}' executed in test suite 'DDT2 csv'.
Doing Test Credentials for ${username} and ${password}                | FAIL |
Variable '${username}' not found.
------------------------------------------------------------------------------
DDT2 csv                                                              | FAIL |
3 tests, 0 passed, 3 failed
==============================================================================

Can anyone please help me out?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source