场景1:判断类型

r
${d} set variable \xba\xcb\xbc\xf5\xcd\xa8\xb9\xfd #核减通过
Run Keyword And Continue On Failure should be byte string ${d}
should be string ${d}
Should Be Unicode String ${d}
Run Keyword And Continue On Failure Should Not Be String ${d}
${e} set variable 核减通过
Run Keyword And Continue On Failure should be byte string ${e}
should be string ${e}
Should Be Unicode String ${e}
Run Keyword And Continue On Failure Should Not Be String ${e}

总结:两个变量均为string 和 unicode string类型,而非byte string类型;

场景2:Encode String To Bytes

e
${d} set variable \xba\xcb\xbc\xf5\xcd\xa8\xb9\xfd
${dUTF8} Encode String To Bytes ${d} UTF-8
${dASCII} Encode String To Bytes ${d} ASCII errors=ignore
${e} set variable 核减通过
${eUTF8} Encode String To Bytes ${e} UTF-8
${eASCII} Run Keyword And Continue On Failure Encode String To Bytes ${e} ASCII
Run Keyword And Continue On Failure should be equal ${eUTF8} ${dUTF8}
Run Keyword And Continue On Failure should be equal ${eASCII} ${dASCII}

执行结果:

Starting test: ZXJF.清结算 一期.互联网核减.e
20170712 11:33:08.790 : INFO : ${d} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.790 : INFO : ${dUTF8} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.790 : INFO : ${dASCII} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.790 : INFO : ${e} = 核减通过
20170712 11:33:08.790 : INFO : ${eUTF8} = \xe6\xa0\xb8\xe5\x87\x8f\xe9\x80\x9a\xe8\xbf\x87
20170712 11:33:08.806 : FAIL : UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
20170712 11:33:08.806 : INFO : ${eASCII} = None
20170712 11:33:08.806 : INFO :
Argument types are:
<type 'str'>
<type 'str'>
20170712 11:33:08.806 : FAIL : \xe6\xa0\xb8\xe5\x87\x8f\xe9\x80\x9a\xe8\xbf\x87 != xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.806 : INFO :
Argument types are:
<type 'NoneType'>
<type 'str'>
20170712 11:33:08.806 : FAIL : None != xbaxcbxbcxf5xcdxa8xb9xfd
Ending test: ZXJF.清结算 一期.互联网核减.e

场景3:Decode Bytes To String

t
${d} set variable \xba\xcb\xbc\xf5\xcd\xa8\xb9\xfd
${dUTF8} Decode Bytes To String ${d} UTF-8
${dASCII} Decode Bytes To String ${d} ASCII errors=ignore
${e} set variable 核减通过
${eUTF8} Run Keyword And Continue On Failure Decode Bytes To String ${e} UTF-8
${eASCII} Run Keyword And Continue On Failure Decode Bytes To String ${e} ASCII errors=ignore
Run Keyword And Continue On Failure should be equal ${eUTF8} ${dUTF8}
Run Keyword And Continue On Failure should be equal ${eASCII} ${dASCII}

执行结果:

Starting test: ZXJF.清结算 一期.互联网核减.t
20170712 11:31:33.780 : INFO : ${d} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.780 : INFO : ${dUTF8} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.780 : INFO : ${dASCII} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.780 : INFO : ${e} = 核减通过
20170712 11:31:33.780 : FAIL : UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
20170712 11:31:33.796 : INFO : ${eUTF8} = None
20170712 11:31:33.796 : FAIL : UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
20170712 11:31:33.796 : INFO : ${eASCII} = None
20170712 11:31:33.796 : INFO :
Argument types are:
<type 'NoneType'>
<type 'unicode'>
20170712 11:31:33.796 : FAIL : None != xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.796 : INFO :
Argument types are:
<type 'NoneType'>
<type 'unicode'>
20170712 11:31:33.812 : FAIL : None != xbaxcbxbcxf5xcdxa8xb9xfd
Ending test: ZXJF.清结算 一期.互联网核减.t

【RF库测试】Encode String To Bytes&Decode Bytes To String& should be string&should be unicode string &should not be string的更多相关文章

  1. 【RF库测试】DateTime库

    术语说明: 1.Epoch指的是一个特定的时间:1970-01-01 00:00:00 UTC. 2.国际标准化组织的国际标准ISO 8601是日期和时间的表示方法,格式是 'YYYY-MM-DD h ...

  2. 【RF库测试】算法运算

  3. 【RF库测试】set variable if

  4. 【RF库测试】关键字get time

    *** Test Cases ***Timestamp ${time} GET TIME ${secs} GET TIME epoch ${year} GET TIME return year ${y ...

  5. 【RF库测试】Variable Should not Exist & variable should exist

    Variable Should not Exist variable should exist

  6. 【RF库测试】Exit For Loop 相关

    1.Exit For Loop If:满足条件时,跳出循环,后面的循环不再执行 2.Continue For Loop If:满足条件时,跳出本次循环,继续执行后面的循环

  7. 【RF库测试】对出错的处理

    1.出错后继续执行:Run Keyword And Continue On Failure 2.获取关键字执行结果后继续执行:Run Keyword And Ignore Error 有时候,我们需要 ...

  8. python3 str.encode bytes.decode

    str.encode 把字符串编码成字节序列 bytes.decode 把字节序列解码成字符串 https://docs.python.org/3.5/library/stdtypes.html st ...

  9. Python使用import导入模块时报ValueError: source code string cannot contain null bytes的解决方案

    老猿在导入一个Python模块时报错: >>> import restartnet.py Traceback (most recent call last): File " ...

随机推荐

  1. Java设计模式(11)外观模式(Facade模式)

    外观模式(Facade)的定义:为子系统中的一组接口提供一个一致的界面. Facade一个典型应用就是数据库JDBC的应用,如下例对数据库的操作: public class DBCompare { C ...

  2. R语言进行数据预处理

    R语言进行数据预处理wranging li_volleyball 2016年3月22日 data wrangling with Rpackages:tidyr dplyr Ground rules l ...

  3. Python 字符串操作函数二

    #-*- coding:utf-8 -*- line = "l want watch movie with you ." print(line.center(50)) print( ...

  4. == equals hashCode 总结比较

    在Java中: ==是运算符,用于比较两个变量是否相等. equals,是Objec类的方法,用于比较两个对象是否相等,默认Object类的equals方法是比较两个对象的地址,跟==的结果一样.Ob ...

  5. spinlock一边连逻辑一边连控制器

    本文来自:我爱研发网(52RD.com) - R&D大本营详细出处:http://www.52rd.com/Blog/Archive_Thread.asp?SID=7179 spinlock的 ...

  6. 基于jquery的ui选择之路

    选定: 主框架:jqueryUi tree:ztree grid:jqGrid layout:jquery.layout 原由: 还有其他demo,ajax实现等参看连接: 正在做的一个项目选择jqu ...

  7. Oracle备份与恢复介绍(物理备份与逻辑备份) 分类: Oracle 2015-07-27 22:59 15人阅读 评论(0) 收藏

    算是挺全的了,有命令有真相 原文链接:http://blog.chinaunix.net/uid-354915-id-3525989.html 一.Oracle备份方式分类: Oracle有两类备份方 ...

  8. Bind-DLZ with MySQL

    系统环境: 系统:centos 6.8 Mysql: 5.1 BIND: bind--P2.tar.gz IP地址:192.168.153.130 软件下载地址:http://ftp.isc.org/ ...

  9. MyMVC配置

    <system.webServer> <validation validateIntegratedModeConfiguration="false"/> & ...

  10. 正则grep

    什么是正则: 正则就是一串有规律的字符串. 正则三剑客: grep/egrep (egrep是grep的扩展),sed, awk grep grep过滤指定关键词 [root@localhost gr ...