我的测试步骤创建了 5 个工作线程来将文件上传到服务器,并为每个线程返回服务器 HTTP 响应代码。我想将这些附加到每个步骤的响应代码列表中。
TC001_Single_User_Upload
[Documentation] Uploading single file by single user
${result} single user test file upload test_file.txt test1 test
Append To List @{RESPONSE_LIST} ${result}
${result} single user test file upload test_file.txt test1 test
Append To List @{RESPONSE_LIST} ${result}
log variables
log many @{RESPONSE_LIST}
Run Code Online (Sandbox Code Playgroud)
我当前的日志文件显示:
20171127 13:59:01.911 - INFO - @{RESPONSE_LIST} = [ ]
20171127 13:59:01.911 - INFO - @{result} = [ <Response [201]> | <Response [201]> | <Response [201]> | <Response [201]> | <Response [201]> ]
Run Code Online (Sandbox Code Playgroud)
问:为什么我的@{RESPONSE_LIST} …
我有一个使用python和Robotframework脚本混合实现的项目.我的项目Config.ini文件中存储了一堆配置项,如下所示:
[Environment]
Username: username@mail.com
Password: testpassword
[WebUI]
login_url: http://testsite.net/
Run Code Online (Sandbox Code Playgroud)
Python能够使用ConfigManager对象解释上述变量,如下所示:
class MyConfigManager(ConfigManager):
"""
Class to hold all config values in form of variables.
"""
def __init__(self):
super().__init__("dispatch/config.ini")
self._android = Android(self._config)
@property
def username(self):
return self._config.get(_env_section, "Username")
@property
def password(self):
return self._config.get(_env_section, "Password")
config = MyConfigManager()
Run Code Online (Sandbox Code Playgroud)
是否可以将Robotframework中的config.ini导入为变量文件并使用这些值?我正在尝试不为我的Robot脚本提供另一个变量文件.
编辑:
我试图用我的机器人文件做这样的事情:
*** Settings ***
Documentation WebUI Login Tests
Library SeleniumLibrary
Resource common_keywords.robot
Variables config.ini
# ^ will this work?
Default Tags Smoke
Suite Setup Set Selenium Timeout 15seconds
Suite Teardown Close Browser
*** …Run Code Online (Sandbox Code Playgroud)