当前位置: 首页 > news >正文

优秀网站界面设计建盏的好处

优秀网站界面设计,建盏的好处,杭州最新消息今天,外贸销售一、什么是 Robot Framework#xff1f; 1. Robot Framework 的历史由来 Robot Framework是一种通用的自动化测试框架#xff0c;最早由Pekka Klrck在2005年开发#xff0c;并由Nokia Networks作为内部工具使用。后来#xff0c;该项目以开源形式发布#xff0c;并得到了…一、什么是 Robot Framework 1. Robot Framework 的历史由来 Robot Framework是一种通用的自动化测试框架最早由Pekka Klärck在2005年开发并由Nokia Networks作为内部工具使用。后来该项目以开源形式发布并得到了广泛的社区支持和贡献。 2.官方介绍 Robot Framework is a generic open source automation framework. It can be used for test automation and robotic process automation (RPA). Robot Framework 是一个通用的开源自动化框架。它可用于测试自动化和机器人流程自动化 RPA。 Robot Framework is supported by Robot Framework Foundation. Many industry-leading companies use the tool in their software development. Robot Framework 由 Robot Framework Foundation 提供支持。许多行业领先的公司在其软件开发中使用该工具。 Robot Framework is open and extensible. Robot Framework can be integrated with virtually any other tool to create powerful and flexible automation solutions. Robot Framework is free to use without licensing costs. 机器人框架是开放且可扩展的。Robot Framework几乎可以与任何其他工具集成以创建强大而灵活的自动化解决方案。Robot Framework 可免费使用无需许可费用。 Robot Framework has an easy syntax, utilizing human-readable keywords. Its capabilities can be extended by libraries implemented with Python, Java or many other programming languages. Robot Framework has a rich ecosystem around it, consisting of libraries and tools that are developed as separate projects. Robot Framework 具有简单的语法使用人类可读的关键字。它的功能可以通过使用 Python、Java 或许多其他编程语言实现的库来扩展。Robot Framework 拥有丰富的生态系统由作为独立项目开发的库和工具组成。 3. 基本语法 测试用例以*** Test Cases ***开头后跟一个或多个测试用例。关键字定义以*** Keywords ***开头后跟一个或多个关键字定义。测试用例和关键字定义使用缩进来表示层次结构。关键字和关键字参数之间使用制表符或多个空格分隔。 4. Code is worth a thousand words代码胜过千言万语 简单示例 此示例包含用户登录的单个测试用例。它使用模拟的后端 API 进行用户管理。该测试套件TestSuite.robot包含两个测试用例“使用密码登录用户”和“使用错误密码拒绝登录”。此测试用例从资源文件 keywords.resource 调用关键字。 TestSuite.robot: *** Settings *** Documentation A test suite for valid login. ... ... Keywords are imported from the resource file Resource keywords.resource Default Tags positive*** Test Cases *** Login User with PasswordConnect to ServerLogin User ironman 1234567890Verify Valid Login Tony Stark[Teardown] Close Server ConnectionDenied Login with Wrong Password[Tags] negativeConnect to ServerRun Keyword And Expect Error *Invalid Password Login User ironman 123Verify Unauthorised Access[Teardown] Close Server ConnectionResource File 资源文件 keywords.resource 包含关键字定义。资源文件还使用库 CustomLibrary.py 中基于 python 的关键字来实现更专业的功能。存在无数社区制作的库它们以各种方式扩展了机器人框架 keywords.resource: *** Settings *** Documentation This is a resource file, that can contain variables and keywords. ... Keywords defined here can be used where this Keywords.resource in loaded. Library CustomLibrary.py*** Keywords *** Connect to ServerConnect fe80::aede:48ff:fe00:1122Close Server ConnectionDisconnectLogin User[Arguments] ${login} ${password}Set Login Name ${login}Set Password ${password}Execute LoginVerify Valid Login[Arguments] ${exp_full_name}${version} Get Server VersionShould Not Be Empty ${version}${name} Get User NameShould Be Equal ${name} ${exp_full_name}Verify Unauthorised AccessRun Keyword And Expect Error PermissionError* Get Server VersionLogin Admin[Documentation] Login Admin is a Keyword.... It calls Login User from CustomLibrary.pyLogin User admin RBTFRMWRKVerify Valid Login Administrator CustomLibrary.py: from TestObject import TestObject from robot.api.logger import info, debug, trace, consoleclass CustomLibrary:This is a user written keyword library.These libraries can be pretty handy for more complex tasks an typicallymore efficiant to implement compare to Resource files.However, they are less simple in syntax and less transparent in test protocols.The TestObject object (t) has the following public functions:class TestObject:def authenticate(self, login: str, password: str) - str: ...def logout(self, token): ...def get_version(self, token) - str: ...def get_user_id(self, token, login) - str: ...def get_user_name(self, token, user_id) - str: ...def get_user(self, token, user_idNone) - Dict[str, str]: ...def get_user_all(self, token) - List[Dict[str, str]]: ...def delete_user(self, token, userid): ...def get_logout(self, token): ...def put_user_password(self, token, new_password, user_idNone): ...def put_user_name(self, token, name, user_idNone): ...def put_user_right(self, token, right, user_id): ...def post_new_user(self, token, name, login) - str: ...ROBOT_LIBRARY_SCOPE SUITEdef __init__(self) - None:self._session Noneself.login self.password self._connection: TestObject Nonedef connect(self, ip):self._connection TestObject(ip)def disconnect(self):self._connection Nonepropertydef connection(self):if not self._connection:raise SystemError(No Connection established! Connect to server first!)return self._connectionpropertydef session(self):if self._session is None:raise PermissionError(No valid user session. Authenticate first!)return self._sessiondef set_login_name(self, login):Sets the users login name and stores it for authentication.self.login logininfo(fUser login set to: {login})def set_password(self, password):Sets the users login name and stores it for authentication.self.password passwordinfo(fPassword set.)def execute_login(self):Triggers the authentication process at the backend and stores the session token.self._session self.connection.authenticate(self.login, self.password)if self.session:info(fUser session successfully set.)debug(fSession token is: {self.session})self.login self.password def login_user(self, login, password) - None:Login User authenticates a user to the backend.The session will be stored during this test suite.self._session self.connection.authenticate(login, password)def logout_user(self):Logs out the current user.self.connection.logout(self.session)def create_new_user(self, name, login, password, right):Creates a new user with the give data.user_id self.connection.post_new_user(self.session, name, login)self.connection.put_user_password(self.session, password, user_iduser_id)self.connection.put_user_right(self.session, right, user_id)def change_own_password(self, new_password, old_password):Changes the own password given the new and current one.self.connection.put_user_password(self.session, new_password, old_password)def change_users_password(self, login, new_password):Changes the password of a user by its name.Requires Admin priviliges!user_id self.get_user_id(login)self.connection.put_user_password(self.session, new_password, user_iduser_id)def get_all_users(self):Get All Users does return a list of user-dictionaries.A user dictionary has the keys name, login, right and active.This keyword need Admin privileges.Example:{name: Peter Parker, login: spider, right: user, active: True}return self.connection.get_user_all(self.session)def get_user_details(self, user_idNone):Returs the user details of the given user_id or if None the own user data.return self.connection.get_user(self.session, user_id)def get_user_id(self, login):Returns the user_id based on login.return self.connection.get_user_id(self.session, login)def get_username(self, user_idNone):Returns the users full name of the given user_id or if None the own user data.return self.connection.get_user_name(self.session, user_id)def get_server_version(self):return self.connection.get_version(self.session)二、为什么选择 Robot Framework Robot Framework支持插件化的架构可以使用许多内置库和第三方库来扩展功能例如SeleniumLibrary用于Web自动化测试RequestsLibrary用于API测试等。 1. Robot Framework 的常见用法 Robot Framework可用于各种自动化测试任务包括 Web应用测试API测试数据库测试移动应用测试自动化任务和流程持续集成和部署 2. 常见关键字库 Robot Framework有广泛的关键字库可供使用以下是一些常见的关键字库 SeleniumLibrary用于Web应用测试包括页面操作、表单填写、页面验证等。RequestsLibrary用于发送HTTP请求进行API测试。DatabaseLibrary用于数据库测试支持各种数据库操作。SSHLibrary用于通过SSH执行命令和操作远程服务器。ExcelLibrary用于读写Excel文件。DateTimeLibrary用于日期和时间相关操作。 3. 技术架构和原理 Robot Framework的技术架构基于关键字驱动的测试方法。它使用Python语言编写通过解析测试用例文件和执行测试步骤来实现自动化测试。 Robot Framework的核心原理如下 测试用例文件通常使用.robot扩展名包含测试用例、关键字定义和设置。测试执行器test runner读取并解析测试用例文件。测试执行器调用相应的关键字库如SeleniumLibrary、RequestsLibrary等执行测试步骤。关键字库提供了一组关键字如打开浏览器、点击按钮等来操作被测试的系统。执行结果被记录下来并生成报告和日志文件。 三、怎么使用 Robot Framework 1. Robot Framework的安装方法 1. 安装Python Robot Framework是基于Python的所以首先需要安装Python。你可以从Python官方网站https://www.python.org下载适合你操作系统的Python安装程序并按照官方指南进行安装。 2. 安装Robot Framework 一旦Python安装完成你可以使用Python的包管理工具pip来安装Robot Framework。打开终端或命令提示符窗口并执行以下命令 pip install robotframework这将下载并安装最新版本的Robot Framework及其依赖项。 3. 安装额外的关键字库 根据你的测试需求你可能需要安装额外的关键字库。例如如果你需要进行Web应用测试可以安装SeleniumLibrary。以安装SeleniumLibrary为例执行以下命令 pip install robotframework-seleniumlibrary类似地你可以使用pip命令安装其他关键字库具体取决于你的需求。 4. 验证安装 安装完成后你可以验证Robot Framework是否成功安装。在终端或命令提示符窗口中执行以下命令 robot --version如果成功安装它将显示安装的Robot Framework的版本号。 2. 自动化测试用例常见实例代码 示例1Web应用测试 *** Settings *** Library SeleniumLibrary*** Test Cases *** Open Browser and Verify TitleOpen Browser https://www.example.com chromeTitle Should Be Example DomainClose Browser示例2API测试 *** Settings *** Library RequestsLibrary*** Test Cases *** Get User DetailsCreate Session Example API https://api.example.com${response} Get Request Example API /users/123Should Be Equal As Strings ${response.status_code} 200${user_details} Set Variable ${response.json()}Log ${user_details}Delete All Sessions示例3数据库测试 *** Settings *** Library DatabaseLibrary Library Collections*** Test Cases *** Verify User in DatabaseConnect To Database pymysql mydatabase myusername mypassword{query_result} Query SELECT * FROM users WHERE id 123Should Contain ${query_result} usernameJohnDisconnect From Database示例4SSH操作 *** Settings *** Library SSHLibrary*** Test Cases *** Execute Command on Remote ServerOpen Connection 192.168.1.100 usernamemyusername passwordmypassword${output} Execute Command ls /path/to/directoryShould Contain ${output} myfile.txtClose Connection示例5Excel操作 *** Settings *** Library ExcelLibrary*** Test Cases *** Read Data From ExcelOpen Excel path/to/excel/file.xlsx${cell_value} Read Cell Data By Name Sheet1 A1Log ${cell_value}Close Excel四、相关链接 Robot Framework官方网站Robot Framework用户指南Robot Framework论坛Robot Framework Github RobotFramework基金会成员
http://www.hkea.cn/news/14534210/

相关文章:

  • 麒麟区住房和城乡建设局网站江苏省住房和城乡建设厅官方网站
  • 汕头网站建设方案推广网站移动端是什么
  • 杭州市建设工程检测协会网站新网站建设一般多少钱
  • 杭州哪个网站建设最好左右左右网站
  • 做企业网站需要买什么宣传页模板
  • wordpress全站关闭评论东莞做网站一年费用
  • 保定网站优化哪家好搜索引擎优化的七个步骤
  • 网站开发常用插件有没有做3d衣服模型网站
  • 济南网络免费推广网站wordpress 加载页面
  • 定制网站开发一般多少钱scc全球电商分发平台
  • 深圳最好的网站建设公司哪家好wordpress中文竖排
  • 建网站需要编程吗怎么推广游戏叫别人玩
  • 北京设计网站的公司百度统计数据
  • 用ps做网站方法绍兴市交通建设有限公司网站
  • 人工智能营销网站开发黑客钓鱼网站的制作
  • joomla网站模板深圳高端网站建设怎么样
  • c2c电子商务网站需具备哪些业务功能重庆为什么导航用不了
  • kesion系统做网站教程常用网站设计缩略图
  • 只有域名如何做网站怎样做类似淘宝网的网站
  • 建站宝盒源码wordpress5.0中文编辑器
  • 视频网站开发公司推广策划案怎么写
  • 网站设计网站制作建站之星安装模板失败
  • 单页面网站现在共享网站的详细规划
  • 彭阳门户网站建设百度惠生活推广怎么收费
  • 北京建设网站网站安徽省建设工程招投标信息网
  • 公司开发个网站多少钱上海企乐网站制作公司
  • 网站用excel做数据库培训网站方案
  • 仿站参考网站wordpress获取页面图片
  • 网站怎么做站内美化php7 nginx wordpress
  • 济南中京网站建设公司天猫网站企业网站专业性诊断分析