python中account用法_Robot框架:使用faker为account d生成前缀字符串

概述

使用faker关键字只需要调用它们,并将结果保存在变量中。不能在变量表中使用faker关键字,需要在testcase或关键字中使用它们。但是,可以使用python变量文件直接从中调用faker命令。在

例如,要获得地址,可以调用Address关键字。因为伪造的关键字是如此通用,我建议完全限定这些关键字,以清楚地表明你正在生成虚假数据。在

例如:*** Settings ***

| Library | FakerLibrary | WITH NAME | faker

*** Test Cases ***

| Example of using faker

| | ${address}= | faker.Address

| | log | address: ${address}

使用Random Int关键字

要获取随机整数,请使用random integer关键字:

^{pr2}$

初始化整个套件的变量

如果要对整个套件使用相同的值,可以编写一个关键字,使用Set Suite Variable关键字设置某些套件级别的变量。在

例如:*** Settings ***

| Library | FakerLibrary | WITH NAME | faker

| Suite Setup | Initialize Test Data

*** Test Cases ***

| Example of using faker to initialize suite variables

| | log | The suite address is ${address}

| | log | The suite md5 is ${md5}

| | log | The suite number is ${number}

*** Keywords ***

| Initialize test data

| | ${address}= | faker.Address

| | ${md5}= | faker.MD5

| | ${number}= | faker.Random Int

| |

| | Set suite variable | ${address}

| | Set suite variable | ${md5}

| | Set suite variable | ${number}

文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值