gpt4 book ai didi

testing - 加载机器人文件的代码行

转载 作者:行者123 更新时间:2023-11-28 21:09:26 24 4
gpt4 key购买 nike

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

文件1.机器人

MyTest1
<Content of other file>
Some other keywords

文件2.机器人

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 中使用关键字.您不能包含原始代码行。

例如:

其他机器人

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

文件1.机器人

*** Settings ***
Resource other.robot

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

关于testing - 加载机器人文件的代码行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39143911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com