Search code examples
robotframeworkdata-driven-tests

Documentation for each test case when using "Test Template" (Data Driven)


When using "Test Template", how can I set [Documentation] to the generated test cases?

I have a workaround for doing it:

*** Settings ***
Test Template    The Test Logic

*** Test Cases ***    arg1   arg2   documentation
Test Case 1            1      a     Doc of test 1
Test Case 2            2      b     Doc of test 2
Test Case 3            3      c     Doc of test 3


*** Keywords ***
The Test Logic
    [Arguments]        ${arg1}     ${arg2}    ${documentation}
    Set Test Documentation      ${documentation}
    Log Many           ${arg1}      ${arg2}

but I think there should be a more native way. I couldn't find such a way. Does anyone know?


Solution

  • I think the best solution available is along the lines of this.

    *** Settings ***
    Test Template    The Test Logic
    
    *** Test Cases ***    arg1   arg2
    Test Case 1            1      a
    Test Case 2            2      b
    Test Case 3            3      c
    
    
    *** Keywords ***
    The Test Logic
        [Arguments]        ${arg1}     ${arg2}
        Set Test Documentation      Test case covering scenario of ${arg1} and ${arg2}
        Log Many           ${arg1}      ${arg2}