我看到两种方法。
1)循环浏览器并调用进行测试的关键字:
*** Variables ***
@{BROWSERS} firefox chrome IE
*** test cases ***
test with several browser
:FOR ${browser} IN @{BROWSERS}
\ log to console call keyword that does your test with ${browser}
这是您通过此测试得到的结果:
[Mac]$ pybot .
Browser.Ts
==============================================================================
test with several browser
call keyword that does your test with firefox
call keyword that does your test with chrome
call keyword that does your test with IE
test with several browser | PASS |
------------------------------------------------------------------------------
Browser.Ts | PASS |
1 critical test, 1 passed, 0 Failed
1 test total, 1 passed, 0 Failed
==============================================================================
2)另一种方式(我更喜欢)是将$ {BROWSER}变量保留为单个值,并使用在命令行中给出的变量的新值多次调用测试用例:
[Mac]$ pybot --variable BROWSER:firefox ts.txt
[Mac]$ pybot --variable BROWSER:chrome ts.txt
[Mac]$ pybot --variable BROWSER:ie ts.txt