Skip to main content
Glama
sourcefuse

Robot Framework MCP Server

by sourcefuse

create_data_driven_test

Generate Robot Framework data-driven test templates from CSV files to automate repetitive test scenarios efficiently.

Instructions

Generate Robot Framework data-driven test template code. Returns .robot file content as text - does not execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_data_fileNotest_data.csv

Implementation Reference

  • The core handler function for the 'create_data_driven_test' tool, decorated with @mcp.tool() for registration in the FastMCP server. It generates a Robot Framework data-driven test template using the provided test_data_file, including DataDriver library integration, variables, test cases, and keywords for login testing.
    @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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sourcefuse/robotframework-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server