从一个关键字访问一个variables到另一个Robot框架

我在一个关键字(1)中创build了一个variables($ {sResultFile}),如下所示: 这是关键字文件1

create excel file ${sResultFile} Add TimeStamp to File ${sResultFilePath} Create File ${sResultFile} Append to file ${sResultFile} TC_Name\tStatus\tComments\n Set Global Variable ${sResultFile} ${sResultFile} [Return] ${sResultFile} 

现在我想访问另一个关键字(2)中的$ {sResultFile},它是在同一个资源文件中

这是关键字文件2

在这里输入图像说明

正如您所看到的,我无法访问关键字文件2中的$ {sResultFile}。我尝试将其设置为Global,但没有运气。 我该怎么做?

你的问题不清楚。

—->如果要将第一个关键字${sResultFile}结果${sResultFile}第二个关键字中,则将第二个关键字的第二行replace为

 append to file create excel file ${cTCNo}\.... 

—->如果要使用第一个关键字的前三行的结果,则创build另一个关键字并返回可用于任何您想要的结果

 Some Keyword ${sResultFile} Add TimeStamp to File ${sResultFilePath} Create File ${sResultFile} [return] Append to file ${sResultFile} TC_Name\tStatus\tComments\n 

所以第二个关键字的第二行就是

 append to file Some Keyword ${cTCNo}\.... 

如果您有任何问题,请让我知道

最简单的方法可能是:

 Set Test Variable ${sResultFile} ${sResultFile}