Kir*_*kov 0 testing random automation browser-automation robotframework
我需要生成随机数并将其分配给变量一次,以便以后多次使用它.我找到了关键字,Generate Random String但我不知道如何将它应用于我的案例.
这是一个例子:
*** Settings ***
Library String
*** test cases ***
login with random string
${password} = Generate Random String 8 [NUMBERS]
login to system login ${password}
*** Keywords ***
login to system
[arguments] ${login} ${password}
log to console \nattempting to log with login ${login} and password ${password}
Run Code Online (Sandbox Code Playgroud)
以及执行它时得到的结果:
[MBP]$ pybot ts.txt
==============================================================================
Ts
==============================================================================
login with random string .
attempting to log with login login and password 30865042
login with random string | PASS |
------------------------------------------------------------------------------
Ts | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
[...]
Run Code Online (Sandbox Code Playgroud)
另一个执行会生成另一个随机数:
[MBP]$ pybot ts.txt
[...]
login with random string .
attempting to log with login login and password 88780307
login with random string | PASS |
------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9446 次 |
| 最近记录: |