pythonrobotframeworkdata-driven-testsdata-driven

AttributeError: 'TestCase' object has no attribute 'lineno', when I try to run test with datadriver library


I wanted to do a test with the DataDriver library, but it doesn't seem to work, I have the following error:

[ ERROR ] Calling method '_start_suite' of listener 'DataDriver' failed: AttributeError: 'TestCase' object has no attribute 'lineno'
first test case exemple                                               | FAIL |
Test case contains no keywords.

This is my test file.robot :

*** Settings ***  
Library           OperatingSystem
Library           Selenium2Library
Library           DataDriver   file=../../Resources/data_test.csv
 
Suite Teardown    Close Browser
Test Template     Open web site 

*** Test Cases ***             
first test case exemple        ${URL}    ${Browser}     
    
 
*** Keywords *** 
Open web site
    [Arguments]    ${URL}    ${Browser}    
    Open Browser    ${URL}    ${Browser}    

My file.csv contains the variable ${URL} and ${Browser}

Can anyone help me please ?


Solution

  • In Robot Framework 4.0 a backward incompatible change has been introduced: Running and result models have been changed. One part of that change is the following:

    In 4.0 the robot.running.model.TestCase class has lineno attribute.
    Before 4.0, for example in 3.1.2 the robot.running.model.TestCase class does not have lineno attribute.

    Given the DataDriver wants to use lineno I would say your framework version is lower than 4.0 and you need to upgrade to the latest release.