我正在使用Robotframework并试图编写一个需要模板以及一些关键字的测试用例。以下是我目前正在做的事情…模板不能在Settings因为有不同的测试用例,每个测试用例都有不同的用例。
当尝试运行TC_003_Edit_Custom_Destination
时,它正在抛出我的错误,这是
关键字'创建目的地无效场景'预期4个参数,得到1.
TC_003_Edit_Custom_Destination
[Documentation] Edit Custom Destination, inside settings tab
[Tags] Testing Edit Custom Destination Functionality
TC_001_Streaming_test_setup other
Cancel create Destination
Click on edit title for new destination created ${destination_title_name}
[Template] Create Destination Invalid Scenarios
${empty} ${empty} ${empty} Please enter an RTMP address
${empty} ${rtmps_address} ${empty} Please enter an stream key
${empty} rtm://google.com 123ABC Invalid Destination
${empty} ${rtmps_address} 123ABC Please give this destination a name
${destination_title_name} ${rtmps_address} 123ABC ${empty}
有没有人知道我如何在TestCase中添加关键字和测试模板?我不想收拾行李TC_001_Streaming_test_setup other Cancel create Destination
inside[Setup]
____更新____
*** Test Cases ***
Test Case with Template
[Template] Template_1
${template_args_1} ${template_args_2}
Some_keywords_1
Some_keywords_2
Some_keywords_3
如果我理解正确的话,您希望在同一个套件中有模板和没有模板的测试用例。
这可以通过在测试级别设置模板来实现,就像我下面的例子一样,你有3个测试用例,2个有不同的模板,1个没有任何模板。
*** Test Cases ***
Test Case with Template
[Template] I Will use this template
This is the first execution variable
This is the second execution
Test using another Template
[Template] Use this template instead
This uses a different template
Test Without Template
Log This test case doesn't use template!
*** Keywords ***
I Will use this template
[Arguments] ${templateVar1}
Log My variable value is ${templateVar1}
Use this template instead
[Arguments] ${anotherVar}
Log This is the other template value: ${anotherVar}