簡體   English   中英

運行機器人框架測試而不將其放入模板文件中

[英]Run robot framework test without put it in the template file

所以我有這個機器人文件:

*** Settings ***
Resource    my_project/products/ese_base_template.robot

*** Test Cases ***
Test_1
    [Tags]  sanity
    foo.some_function

模板文件

*** Settings ***
Library     my_project.src.my_manager.foo_class.Foo       WITH NAME       foo

*** Keywords ***

我的課

class Foo:
    def some_function(self):
        print('Some function')

所以我想運行這個.robot測試而不在我的模板文件中指定測試*** Test Cases ***所以我只運行命令robot path_to_my_test_file.robot anf 得到這個錯誤:

Suite 'Ese Base Template' contains no tests or tasks.

您是否有理由不想定義任何關鍵字?

比如說,讓測試用例調用一個關鍵字:

*** Settings ***
Resource    my_project/products/ese_base_template.robot

*** Test Cases ***
Test_1
    [Tags]  sanity
    Call some function

然后在模板中定義該關鍵字,例如:

*** Settings ***
Library     my_project.src.my_manager.foo_class.Foo       WITH NAME       foo

*** Keywords ***
Call some function
    foo.some_function

你不需要在模板文件中包含測試用例,你仍然可以運行命令robot path_to_my_test_file.robot

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM