2
votes

I expect the Test Setup and Test Teardown keywords to run for every execution of a templated test but that does not seem to be the case. Here's a boiled-down version of my test suite that demonstrates what I'm talking about. I run it like pybot template-problem.txt. Notice that the resulting log file shows that my Test Case Setup and Test Case Teardown keywords were each run only one time.

*** Settings ***
Test Setup        Test Case Setup
Test Teardown     Test Case Teardown

*** Test Cases ***
Look for All Possible Outputs from the System Under Test
    [Template]    Look for Specific Output
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    T
    U
    V
    W
    X
    Y
    Z

*** Keywords ***
Test Case Setup
    Comment    Setting up before the test case runs

Test Case Teardown
    Comment    Cleaning up after the test case finishes

Look For Specific Output
    [Arguments]    ${output}
    Comment    Pretending to look for a specific output...
    Log    ${output}
1

1 Answers

2
votes

From the Robot Framework documentation on test templates:

Whereas the body of the normal test case is constructed from keywords and their possible arguments, test cases with template define only the arguments for the template keyword.

So, using templates is just a way to transform your testcase into:

Look for All Possible Outputs from the System Under Test
    Look for Specific Output    A
    Look for Specific Output    B
    Look for Specific Output    C
    ...

i.e. it's still just one test case calling the same keyword many times in a row with different arguments.