{"id":7683,"library":"robotframework-datadriver","title":"Robot Framework DataDriver","description":"robotframework-datadriver is a library for Data-Driven Testing within the Robot Framework ecosystem. It allows users to separate test data from test logic, making it easier to manage and scale tests by running the same test case with multiple sets of input data. The library is actively maintained, with version 1.11.2 being the latest, and it frequently releases updates to ensure compatibility with new Robot Framework versions.","status":"active","version":"1.11.2","language":"en","source_language":"en","source_url":"https://github.com/Snooz82/robotframework-datadriver","tags":["robotframework","testing","data-driven","automation","excel","csv","json","yaml"],"install":[{"cmd":"pip install robotframework-datadriver","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency for running DataDriver tests, requires >=3.2.2.","package":"robotframework","optional":false},{"reason":"Required for reading Excel (.xlsx, .xls) and CSV files. Not strictly required if only using JSON, YAML, or custom readers.","package":"pandas","optional":true}],"imports":[{"note":"This is primarily for users implementing custom data readers in Python. The core library is typically loaded directly in Robot Framework test suites (e.g., `Library    DataDriver    my_data.xlsx`).","symbol":"AbstractDataDriverReader","correct":"from DataDriver import AbstractDataDriverReader"}],"quickstart":{"code":"import os\nimport subprocess\n\n# Create a dummy data file (e.g., my_data.csv)\ncsv_content = \"TEST_NAME,param1,param2\\nTest 1,ValueA,ValueB\\nTest 2,ValueC,ValueD\"\nwith open('my_data.csv', 'w') as f:\n    f.write(csv_content)\n\n# Create a Robot Framework test suite (e.g., my_tests.robot)\nrobot_content = \"\"\"\n*** Settings ***\nLibrary    DataDriver    my_data.csv\n\n*** Test Cases ***\nMy Data-Driven Test\n    Log To Console    Data Row: ${data_row}\n    Log To Console    Test Name: ${TEST_NAME}\n    Log To Console    Param1: ${param1}\n    Log To Console    Param2: ${param2}\n\"\"\"\nwith open('my_tests.robot', 'w') as f:\n    f.write(robot_content)\n\n# Run the Robot Framework tests using subprocess\nprint(\"Running Robot Framework tests...\")\nresult = subprocess.run(['robot', 'my_tests.robot'], capture_output=True, text=True)\nprint(result.stdout)\nif result.stderr:\n    print(result.stderr)\n\n# Clean up generated files\nos.remove('my_data.csv')\nos.remove('my_tests.robot')\nos.remove('output.xml')\nos.remove('log.html')\nos.remove('report.html')","lang":"python","description":"This quickstart demonstrates how to use `robotframework-datadriver` with a simple CSV data file. It creates a CSV file and a Robot Framework test suite (`.robot` file) on the fly, then executes the tests using the `robot` command-line tool. Each row in the CSV will generate a separate test case, logging the provided parameters."},"warnings":[{"fix":"Upgrade `robotframework-datadriver` to at least version 1.11.2 to ensure full compatibility and fixes for Robot Framework 7.x.","message":"Breaking changes in Robot Framework 7.x APIs require `robotframework-datadriver` version 1.10.0 or higher for basic compatibility, and 1.11.1+ for features like `RerunFailed`.","severity":"breaking","affected_versions":"<1.10.0 (for basic RF7), <1.11.1 (for RerunFailed with RF7)"},{"fix":"Upgrade `robotframework-datadriver` to version 1.9.0 or higher. This fix applies to Robot Framework 5.0 and newer.","message":"When using `robot.run` (programmatically, not via CLI), `DataDriver` previously could not correctly pick up `include` or `exclude` tags.","severity":"gotcha","affected_versions":"<1.9.0"},{"fix":"Upgrade `robotframework-datadriver` to version 1.8.0 or higher, which includes a fix to preserve the string 'None' from Excel files.","message":"Pandas 2.0 changed its default behavior, interpreting the string 'None' in Excel cells as a `None` value (NaN in pandas) instead of the literal string 'None'.","severity":"gotcha","affected_versions":"<1.8.0 when used with Pandas >=2.0"},{"fix":"Upgrade `robotframework-datadriver` to version 1.8.1 or higher for improved custom reader import reliability.","message":"Earlier versions had issues correctly importing custom data readers by their module name, leading to `ModuleNotFoundError` or similar import failures.","severity":"gotcha","affected_versions":"<1.8.1"},{"fix":"Upgrade `robotframework-datadriver` to version 1.6.0 or higher to correctly handle `|` in test case names.","message":"Test case names containing the `|` character (pipe symbol) could cause issues in earlier versions, especially when used with Pabot.","severity":"gotcha","affected_versions":"<1.6.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install robotframework-datadriver` to install the library.","cause":"The `robotframework-datadriver` package is not installed in the Python environment being used by Robot Framework.","error":"Importing library 'DataDriver' failed: ModuleNotFoundError: No module named 'DataDriver'"},{"fix":"Provide the path to your data file when importing the library, e.g., `Library    DataDriver    path/to/my_data.xlsx`.","cause":"The DataDriver library requires at least one argument, which is the path to the data file (e.g., Excel, CSV, JSON).","error":"Invalid argument count for Library 'DataDriver'. Expected 1 to 2 arguments, got 0."},{"fix":"Upgrade `robotframework-datadriver` to version 1.11.1 or higher to fix compatibility issues with Robot Framework 7.x's RerunFailed modifier.","cause":"Robot Framework 7.x introduced internal API changes, specifically relocating `robot.running.model.Variable`, which affected the RerunFailed feature in older DataDriver versions.","error":"RERUN FAILED tests with DataDriver does not work after upgrading to Robot Framework 7."},{"fix":"Upgrade `robotframework-datadriver` to version 1.8.0 or higher. This version includes a fix that ensures the string 'None' is preserved.","cause":"This is due to a change in Pandas 2.0 where the string 'None' is by default converted to a `None` value when reading Excel files, and `robotframework-datadriver` versions prior to 1.8.0 did not account for this.","error":"Excel cell containing 'None' is interpreted as NaN or empty instead of string 'None' when using DataDriver."}]}