加载机器人文件的代码行

Load code lines for a robot-file

我有大量的机器人文件。在所有这些文件中,一部分代码是相同的。由于 DRY,我想缩短文件并将代码放入另一个文件。那么如何从其他文件中调用这 100 行机器人代码呢?

file1.robot

MyTest1
    <Content of other file>
    Some other keywords

file2.robot

MyTest2
    <Content of other file>
    Some other keywords

其他文件

Log to console    1
Log to console    2
Log to console    3
Log to console    .
Log to console    .
Log to console    100

方法是在 resource file 中使用关键字。您不能包含原始代码行。

例如:

other.robot

*** Keywords ***
Do something
    log to console   1
    log to console   2
    ...

file1.robot

*** Settings ***
Resource    other.robot

*** Test Cases ***
MyTest1
    do something
    Some other keywords