<p>我看到了两种方法。</p>
<p>1)在浏览器上循环并调用进行测试的关键字:</p>
<pre><code>*** 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}
</code></pre>
<p>这是你这次考试的收获:</p>
<pre><code>[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
==============================================================================
</code></pre>
<p>2)另一种方法(我更喜欢)是将${BROWSER}变量保留为一个值,并多次使用在命令行上为变量提供的新值调用测试用例:</p>
<pre><code>[Mac]$ pybot --variable BROWSER:firefox ts.txt
[Mac]$ pybot --variable BROWSER:chrome ts.txt
[Mac]$ pybot --variable BROWSER:ie ts.txt
</code></pre>