温馨提示:本文翻译自stackoverflow.com,查看原文请点击:robotframework - Documentation for each test case when using "Test Template" (Data Driven)
data-driven-tests robotframework

robotframework - 使用“测试模板”(数据驱动)时每个测试用例的文档

发布于 2020-04-15 11:22:22

使用“测试模板”时,如何为生成的测试用例设置[文档]?

我有一个解决方法:

*** 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}

但我认为应该有一种更原生的方式。我找不到这样的方法。有人知道吗?

查看更多

提问者
Erez
被浏览
49
FinlayL 2020-02-03 19:27

我认为最好的解决方案就是遵循这一思路。

*** 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}