Robot Framework之数据类型及变量运算

时间:2024-05-19 10:08:04

一、数字变量

Robot Framework之数据类型及变量运算
数字变量 Demo

执行结果:

Starting test: Test.Testsuit.baidutest

20171207 08:56:18.259 :  INFO : ${var} = 3

20171207 08:56:18.259 :  INFO : ${float} = 3.14

20171207 08:56:18.259 :  INFO : ${float} = -0.0001

Ending test:  Test.Testsuit.baidutest

二、布尔变量和None/null

Robot Framework之数据类型及变量运算
布尔变量和None/null Demo

执行结果:

Starting test: Test.Testsuit.baidutest

20171207 09:02:29.583 :  INFO : ${test_true} = True

20171207 09:02:29.584 :  INFO : ${test_false} = False

20171207 09:02:29.585 :  INFO : ${test_None} = None

20171207 09:02:29.586 :  INFO : ${test_null} = None

三、字符串、元组、list和字典

Robot Framework之数据类型及变量运算
字符串、元组、list和字典 Demo

执行结果:

Starting test: Test.Testsuit.baidutest

20171207 09:07:35.673 :  INFO : ${string} = test

20171207 09:07:35.673 :  INFO : ${tuple} = (1, 3)

20171207 09:07:35.673 :  INFO : ${list} = [u'1', u'yy']

20171207 09:07:35.673 :  INFO : ${Dictionary} = {u'b': u'3', u'a': u'5'}

四、space和empty

Robot Framework之数据类型及变量运算
space和empty Demo

执行结果:

Starting test: Test.Testsuit.baidutest

20171207 09:15:07.090 :  INFO : ${test_space} =

20171207 09:15:07.090 :  INFO : ${test_引号空格} = ' '

20171207 09:15:07.090 :  INFO : ${test_4个space} =

20171207 09:15:07.090 :  INFO : ${test_space} = "  "

20171207 09:15:07.090 :  INFO : ${Dictionary} =

五、特殊变量运算

Robot Framework之数据类型及变量运算
特殊变量运算 Demo

执行结果:

Starting test: Test.Testsuit.baidutest

20171207 09:19:59.715 :  INFO : ${数字变量运算} = 32

20171207 09:19:59.725 :  INFO : ${布尔类型true运算} = 4

20171207 09:19:59.725 :  INFO : ${布尔类型false运算} = 0

20171207 09:19:59.725 :  INFO : ${space运算} =

六、Evaluate使用

函数释义:Evaluate是执行python表达式,并返回执行结果

Robot Framework之数据类型及变量运算
Evaluate和python表达式运算 Demo

执行结果: