create_data_driven_test
Generate data-driven Robot Framework test templates from a CSV file. Outputs .robot file content for creating automated tests without execution, streamlining test automation workflows.
Instructions
Generate Robot Framework data-driven test template code. Returns .robot file content as text - does not execute.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| test_data_file | No | test_data.csv |
Implementation Reference
- mcp_server.py:945-989 (handler)Handler function decorated with @mcp.tool(), implementing the create_data_driven_test tool. Generates Robot Framework data-driven test template code from a CSV file input.@mcp.tool() def create_data_driven_test(test_data_file: str = "test_data.csv") -> str: """Generate Robot Framework data-driven test template code. Returns .robot file content as text - does not execute.""" template = f"""*** Settings *** Library SeleniumLibrary Library DataDriver {test_data_file} encoding=utf-8 Test Template Login Test Template *** Variables *** ${{BROWSER}} Chrome ${{BASE_URL}} https://www.appurl.com *** Test Cases *** Login Test With ${{username}} And ${{password}} [Tags] data-driven login # Test case will be generated for each row in CSV *** Keywords *** Login Test Template [Arguments] ${{username}} ${{password}} ${{expected_result}} [Documentation] Template for data-driven login tests Open Browser ${{BASE_URL}} ${{BROWSER}} Maximize Browser Window Input Text id=user-name ${{username}} Input Text id=password ${{password}} Click Button id=login-button Run Keyword If '${{expected_result}}' == 'success' ... Wait Until Page Contains Element xpath=//span[@class='title'] 10s ... ELSE ... Wait Until Page Contains Element xpath=//h3[@data-test='error'] 10s [Teardown] Close Browser *** Comments *** # Create {test_data_file} with columns: username,password,expected_result # Example CSV content: # username,password,expected_result # standard_user,secret_sauce,success # locked_out_user,secret_sauce,error # invalid_user,wrong_password,error """ return template
- mcp_server.py:945-945 (registration)The @mcp.tool() decorator registers the create_data_driven_test function as an MCP tool.@mcp.tool()