• 【RF库测试】Encode String To Bytes&Decode Bytes To String& should be string&should be unicode string &should not be string


    场景1:判断类型

    r
    ${d} set variable xbaxcbxbcxf5xcdxa8xb9xfd #核减通过
    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 xbaxcbxbcxf5xcdxa8xb9xfd
    ${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} = xe6xa0xb8xe5x87x8fxe9x80x9axe8xbfx87
    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 : xe6xa0xb8xe5x87x8fxe9x80x9axe8xbfx87 != 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 xbaxcbxbcxf5xcdxa8xb9xfd
    ${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

  • 相关阅读:
    【Linux】kali 安装 python3 和 pip3(亲测有效)
    Xcode10:library not found for -lstdc++.6.0.9 临时解决
    React-Native入门
    CodeSign error: no provisioning profile at path '/Users/zhht-2015/Library/MobileDevice/Provisioning Profiles/79693141-f98b-4ac4-8bb4-476c9475f265.mobileprovision'
    Please verify that your device’s clock is properly set, and that your signing certificate is not expired.
    “Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”
    出现An App ID with Identifier 'com.XXX.XXX’ is not available. Please enter a different string.
    iOS的项目目录结构
    cocoa pods最新安装说明和使用方法
    真机调试报The executable was signed with invalid entitlements.错误
  • 原文地址:https://www.cnblogs.com/apple2016/p/7154514.html
Copyright © 2020-2023  润新知