如何将资源文件中的变量列表调用到机器人测试中?

How to call list of variables from a resource file into Robot test?

我有 1000 URL 个名字要发送给机器人测试。所以我计划将每个 URL 分配给一个名为 ${ URL1}, ${URL2}... 等的变量。当我在 "test.robot" 它按预期工作。 但是,当我从资源文件中调用这些变量时,出现 "resources.txt' is empty" 错误,如下面的日志所示。

[ WARN ] Imported resource file 'C:\Users\test\Desktop\IMPORTANT - Robot Fram
work - Final Project Data\URL\resources.txt' is empty.
==============================================================================
Url based apps test suite
==============================================================================
testcase1                                                             | FAIL |
Variable '${URL1}' not found.
------------------------------------------------------------------------------
testcase2                                                             | FAIL |
Variable '${URL2}' not found.
------------------------------------------------------------------------------
Url based apps test suite                                             | FAIL |
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================

resources.txt内容:

${URL1}     http://www.4shared.com/
${URL2}     http://depositfiles.com/
${URL3}     https://www.gmail.com/

test.robot设置内容:

*** Settings ***

Library         Selenium2Library
Library         SSHLibrary
Suite Teardown  Close All Browsers
Resource        resources.txt

请帮我解决这个问题。

提前致谢

您的 resources.txt 应该以 "variables" header:

开头
*** Variables ***
${URL1}     http://www.4shared.com/
${URL2}     http://depositfiles.com/
${URL3}     https://www.gmail.com/

请参阅用户指南中的 Resource file structure:"The higher-level structure of resource files is the same as that of test case files otherwise"。