robotframework的学习笔记(十六)----robotframework标准库String
官方文档:http://robotframework.org/robotframework/latest/libraries/String.html
Introduction
A test library for string manipulation and verification.String is Robot Framework's standard library for manipulating strings
Following keywords from BuiltIn library can also be used with strings:
- Catenate
- Get Length
- Length Should Be
- Should (Not) Be Empty
- Should (Not) Be Equal (As Strings/Integers/Numbers)
- Should (Not) Match (Regexp)
- Should (Not) Contain
- Should (Not) Start With
- Should (Not) End With
- Convert To String
- Convert To Bytes
Altogether 30 keywords.
| Keyword | Arguments | Documentation | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Convert To Lowercase | string |
Converts string to lowercase. Examples:
New in Robot Framework 2.8.6. |
||||||||||||||||||||||||||||||
| Convert To Uppercase | string |
Converts string to uppercase. Examples:
New in Robot Framework 2.8.6. |
||||||||||||||||||||||||||||||
| Decode Bytes To String | bytes, encoding,errors=strict |
Decodes the given
Examples:
Use Encode String To Bytes if you need to convert Unicode strings to byte strings, and Convert To String in |
||||||||||||||||||||||||||||||
| Encode String To Bytes | string, encoding,errors=strict |
Encodes the given Unicode
Examples:
Use Convert To Bytes in |
||||||||||||||||||||||||||||||
| Fetch From Left | string, marker |
Returns contents of the If the See also Fetch From Right, Split String and Split String From Right. |
||||||||||||||||||||||||||||||
| Fetch From Right | string, marker |
Returns contents of the If the See also Fetch From Left, Split String and Split String From Right. |
||||||||||||||||||||||||||||||
| Generate Random String | length=8, chars=[LETTERS][NUMBERS] |
Generates(生成) a string with a desired(期望) The population sequence
Examples:
log: 20170719 11:20:59.200 : INFO : ${ret} = bjgo5Rz7 |
||||||||||||||||||||||||||||||
| Get Line | string, line_number |
Returns the specified line from the given Line numbering starts from 0 and it is possible to use negative indices(负数) to refer to lines from the end. The line is returned without the newline character. Examples:
Use Split To Lines if all lines are needed. |
||||||||||||||||||||||||||||||
| Get Line Count | string |
Returns and logs the number of lines in the given string. |
||||||||||||||||||||||||||||||
| Get Lines Containing String | string, pattern,case_insensitive=False |
Returns lines of the given The The match is case-sensitive by default, but giving Lines are returned as one string catenated back together with newlines. Possible trailing newline is never returned. The number of matching lines is automatically logged. Examples:
See Get Lines Matching Pattern and Get Lines Matching Regexp if you need more complex pattern matching. |
||||||||||||||||||||||||||||||
| Get Lines Matching Pattern | string, pattern,case_insensitive=False |
Returns lines of the given The
A line matches only if it matches the The match is case-sensitive by default, but giving Lines are returned as one string catenated back together with newlines. Possible trailing newline is never returned. The number of matching lines is automatically logged. Examples:
See Get Lines Matching Regexp if you need more complex patterns and Get Lines Containing String if searching literal strings is enough. |
||||||||||||||||||||||||||||||
| Get Lines Matching Regexp | string, pattern,partial_match=False |
Returns lines of the given See BuiltIn.Should Match Regexp for more information about Python regular expression syntax in general and how to use it in Robot Framework test data in particular. By default lines match only if they match the pattern fully, but partial matching can be enabled by giving the If the pattern is empty, it matches only empty lines by default. When partial matching is enabled, empty pattern matches all lines. Notice that to make the match case-insensitive, you need to prefix the pattern with case-insensitive flag Lines are returned as one string concatenated back together with newlines. Possible trailing newline is never returned. The number of matching lines is automatically logged. Examples:
See Get Lines Matching Pattern and Get Lines Containing String if you do not need full regular expression powers (and complexity).
|
||||||||||||||||||||||||||||||
| Get Regexp Matches | string, pattern,*groups |
Returns a list of all non-overlapping matches in the given string.
If no groups are used, the returned list contains full matches. If one group is used, the list contains only contents of that group. If multiple groups are used, the list contains tuples that contain individual group contents. All groups can be given as indexes (starting from 1) and named groups also as names. Examples:
=> ${no match} = []
New in Robot Framework 2.9. |
||||||||||||||||||||||||||||||
| Get Substring | string, start,end=None |
Returns a substring from The Examples:
|
||||||||||||||||||||||||||||||
| Remove String | string, *removables |
Removes all
Use Remove String Using Regexp if more powerful pattern matching is needed. If only a certain number of matches should be removed, Replace String or Replace String Using Regexp can be used. A modified version of the string is returned and the original string is not altered. Examples:
New in Robot Framework 2.8.2. |
||||||||||||||||||||||||||||||
| Remove String Using Regexp | string, *patterns |
Removes This keyword is otherwise identical to Remove String, but the New in Robot Framework 2.8.2. |
||||||||||||||||||||||||||||||
| Replace String | string, search_for,replace_with,count=-1 |
Replaces
If the optional argument A modified version of the string is returned and the original string is not altered. Examples:
|
||||||||||||||||||||||||||||||
| Replace String Using Regexp | string, pattern,replace_with,count=-1 |
Replaces This keyword is otherwise identical to Replace String, but the If you need to just remove a string see Remove String Using Regexp. Examples:
|
||||||||||||||||||||||||||||||
| Should Be Byte String | item, msg=None |
Fails if the given Use Should Be Unicode String if you want to verify the The default error message can be overridden with the optional |
||||||||||||||||||||||||||||||
| Should Be Lowercase | string, msg=None |
Fails if the given For example, The default error message can be overridden with the optional See also Should Be Uppercase and Should Be Titlecase. |
||||||||||||||||||||||||||||||
| Should Be String | item, msg=None |
Fails if the given With Python 2, except with IronPython, this keyword passes regardless is the With Python 3 and IronPython, this keyword passes if the string is a Unicode string but fails if it is bytes. Notice that with both Python 3 and IronPython, The default error message can be overridden with the optional |
||||||||||||||||||||||||||||||
| Should Be Titlecase | string, msg=None |
Fails if given
For example, The default error message can be overridden with the optional See also Should Be Uppercase and Should Be Lowercase. |
||||||||||||||||||||||||||||||
| Should Be Unicode String | item, msg=None |
Fails if the given Use Should Be Byte String if you want to verify the The default error message can be overridden with the optional |
||||||||||||||||||||||||||||||
| Should Be Uppercase | string, msg=None |
Fails if the given For example, The default error message can be overridden with the optional See also Should Be Titlecase and Should Be Lowercase. |
||||||||||||||||||||||||||||||
| Should Not Be String | item, msg=None |
Fails if the given See Should Be String for more details about Unicode strings and byte strings. The default error message can be overridden with the optional |
||||||||||||||||||||||||||||||
| Split String | string,separator=None,max_split=-1 |
Splits the If a Split words are returned as a list. If the optional Examples:
See Split String From Right if you want to start splitting from right, and Fetch From Left and Fetch From Right if you only want to get first/last part of the string. |
||||||||||||||||||||||||||||||
| Split String From Right | string,separator=None,max_split=-1 |
Splits the Same as Split String, but splitting is started from right. This has an effect only when Examples:
|
||||||||||||||||||||||||||||||
| Split String To Characters | string |
Splits the given Example:
|
||||||||||||||||||||||||||||||
| Split To Lines | string, start=0,end=None |
Splits the given string to lines. It is possible to get only a selection of lines from Lines are returned without the newlines. The number of returned lines is automatically logged. Examples:
Use Get Line if you only need to get a single line. |
||||||||||||||||||||||||||||||
| Strip String | string, mode=both,characters=None |
Remove leading and/or trailing whitespaces from the given string.
If the optional Examples:
New in Robot Framework 3.0. |
robotframework的学习笔记(十六)----robotframework标准库String的更多相关文章
- python3.4学习笔记(十六) windows下面安装easy_install和pip教程
python3.4学习笔记(十六) windows下面安装easy_install和pip教程 easy_install和pip都是用来下载安装Python一个公共资源库PyPI的相关资源包的 首先安 ...
- python3.4学习笔记(十五) 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等)
python3.4学习笔记(十五) 字符串操作(string替换.删除.截取.复制.连接.比较.查找.包含.大小写转换.分割等) python print 不换行(在后面加上,end=''),prin ...
- (C/C++学习笔记) 十六. 预处理
十六. 预处理 ● 关键字typeof 作用: 为一个已有的数据类型起一个或多个别名(alias), 从而增加了代码的可读性. typedef known_type_name new_type_nam ...
- Python学习笔记011_模块_标准库_第三方库的安装
容器 -> 数据的封装 函数 -> 语句的封装 类 -> 方法和属性的封装 模块 -> 模块就是程序 , 保存每个.py文件 # 创建了一个hello.py的文件,它的内容如下 ...
- JavaScript权威设计--CSS(简要学习笔记十六)
1.Document的一些特殊属性 document.lastModified document.URL document.title document.referrer document.domai ...
- MySQL学习笔记十六:锁机制
1.数据库锁就是为了保证数据库数据的一致性在一个共享资源被并发访问时使得数据访问顺序化的机制.MySQL数据库的锁机制比较独特,支持不同的存储引擎使用不同的锁机制. 2.MySQL使用了三种类型的锁机 ...
- python 学习笔记十六 django深入学习一 路由系统,模板,admin,数据库操作
django 请求流程图 django 路由系统 在django中我们可以通过定义urls,让不同的url路由到不同的处理函数 from . import views urlpatterns = [ ...
- SharpGL学习笔记(十六) 多重纹理映射
多重纹理就把多张贴图隔和在一起.比如下面示例中,一个表现砖墙的纹理,配合一个表现聚光灯效果的灰度图,就形成了砖墙被一个聚光灯照亮的效果,这便是所谓的光照贴图技术. 多重纹理只在OpenGL扩展库中才提 ...
- yii2源码学习笔记(十六)
Module类的最后代码 /** * Registers sub-modules in the current module. * 注册子模块到当前模块 * Each sub-module shoul ...
- Swift学习笔记十六:协议
Protocol(协议)用于统一方法和属性的名称,而不实现不论什么功能. 协议可以被类.枚举.结构体实现.满足协议要求的类,枚举,结构体被称为协议的遵循者. 遵循者须要提供协议指定的成员,如属性,方法 ...
随机推荐
- 独家探寻阿里安全潘多拉实验室,完美越狱苹果iOS11.2.1
知道如何从攻击的视角去发现漏洞,才能建立更安全的体系,促进了整个生态的良性发展.以阿里安全潘多拉实验室为例,在对移动系统安全研究的过程中,把研究过程中发现的问题上报给厂商,促进系统安全性的提升. 小编 ...
- VantPy自动化测试框架
1.必须要谈的一点,就是我们学习自动测试不是用来炫耀的,而是用来提升自身能力的. 2.这个框架不是通用框架,只是在这里灌输这个框架的思想,让每个人写框架都易如反掌 3.如果没有python基础的同学, ...
- Linux中MySQL5.6编译安装与MySQL5.7二进制安装步骤
首先,介绍一下MySQL的几种安装方式 1.RPM.Yum 的安装方式:安装方便.安装速度快,无法定制 2.二进制:不需要安装,解压即可使用,不能定制功能 3.编译安装:可定制,安装慢. 编译安装中需 ...
- json解析—Gson以及GsonFormat插件的运用
最近开始慢慢做毕业设计了,遇到一个功能是获取天气预报的,我选择的是和风天气的api,返回的是JSON数据,所以遇到了解析JSON的问题 首先简单说下JSON,JSON(JavaScript Objec ...
- 移动 云MAS 发短信 .net HTTP 请求
本人开发移动云MAS .net Http 请求 代码如下 using Newtonsoft.Json.Linq; using System; using System.Collections.Gen ...
- Android4.0-4.4 加入支持状态栏显示耳机图标方法(支持带不带MIC的两种耳机自己主动识别)
效果如图: 一. 在frameworks/base/packages/SystemUI/res/values/strings.xml 里加入 <string name="headset ...
- Oracle集合操作
在Oracle中提供了三种类型的集合操作: 并(UNION).交(INTERSECT).差(MINUS) UNION:将多个查询的结果组合到一个查询结果之中,并去掉反复值 UNION ALL:将多个查 ...
- ABP入门系列(21)——切换MySQL数据库
ABP入门系列目录--学习Abp框架之实操演练 源码路径:Github-LearningMpaAbp 1. 引言 Abp支持MySql已经不是什么新鲜事了,但按照官方文档:Entity Framewo ...
- Mybatis中如何将POJO作为参数传入sql
今天在工作时,需要将获取的用户的注册信息插入数据库,开始的做法是将所有的model的属性作为DAO接口的参数,后来想想不对劲,要是有100个属性,那我这个接口岂不是要有100个参数传进来? 于是我就考 ...
- VUE-CLI Vue安装及开发,npm run build无法查看项目的问题
Vue-cli 本地安装vue项目 需要安装node.js,用node命令行npm的方式安装Vue 步骤: 1.进入项目地址安装 npm install vue-cli -g 2.初始化一下 ESli ...
