您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

我们如何在robotframework中一次通过不同的浏览器

我们如何在robotframework中一次通过不同的浏览器

我看到两种方法

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
其他 2022/1/1 18:14:29 有688人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶