DataFactory大数据量测试性能测试过程中的使用
1、How?
第一步:打开DataFactory
2、第二步:选择数据库,进行连接
3
4、第三步:选择要创建数据的表
5、第四步:开始做测试数据
6、插入数据类型
n 从数据表插入数据,这里的数据表是系统提供的。
n 从数据库插入数据,我们需要自己编写SQL语句从数据库中提取数据。
n 用表达式产生数据,我们可以编写表达式,系统将使用结果生成数据。表达式中允许使用的运算符和格式请参见附录。
n 插入连续的值,我们能够设定种子及增长值的大小,系统自动计算结果,如:种子为1,增长值为2,则产生的数据序列为1,3,5,7……
n 插入随机值,我们可以设置其范围,则结果大小在设定范围之内。
n 插入常量,结果将为常量值
7、下面着重说一下,我们经常遇到的数据插入
1、 字段为Date类型
比如:系统产生的日志入库,每秒1条数据。
8
9、2、 字段为递增类型
比如:手机号码
10
11、3、 字段为数据库其他表字段
例如:USERID必须和user_info表中的主键一致
12、4、 字段为固定的几种类型
如:性别为1、2
13、其中c:\111目录下面包含两个文件,文件里面的内容分别为1和2
14、实践
我们数据库字段都是字符型的,大部分都是yyyymmddHHMMSS这种格式,需要设置日期的格式进行录入,通过查看F1帮助文档,得到。 只要我们能想到的,基本上DataFacotry都已经实现了,太强大了。
Setting Custom FormatsThe custom format settings allows you to generate the date/time fields using parameters. For example:
Custom format: %m/%d/%Y %H:%M:%S
Generated date/time: 03/28/2005 14:18:52
Below is a list of the available parameters.
ParameterDefinition%aAbbreviated weekday name%AFull weekday name%bAbbreviated month name%BFull month name%cDate and time representing appropriate locale%dDay of month as decimal number (01-31)%HHour in 24-hour format (00-23)%IHour in 12 hour format (01-12)%jDay of year as decimal number (001-366)%mMonth as decimal number (01-12)%MMinute as decimal number (00-59)%pCurrent locale’s A.M./P.M indicator for 12 hour clock%SSecond as decimal number (00-59)%UWeek of year as decimal number, with Sunday as first day of the week (00-53)%wWeekday as decimal number (0-6; Sunday is 0)%WWeek of year as decimal number, with Monday as first day of the week (00-53)%xDate representation for current locale%XTime representation for current locale%yYear without century, as decimal (00-99)%YYear with century, as decimal number%z, %ZEither the time-zone name or the time zone abbreviation, depending on registry settings; no characters if time zone is unknown%%Percent sign