[英]Can you have cross browser testing using Robot Framework
I have a robot-framework test suite that runs all OK. 我有一个运行正常的机器人框架测试套件。
I have it running with pabot and selenium Grid, so parallel testing is all good. 我让它与pabot和Selenium Grid一起运行,因此并行测试都很好。
My question is, can I run my test suite against multiple browsers without having to manually run the same scripts for each browser or duplicating my test suite for each browser. 我的问题是,我可以针对多个浏览器运行测试套件,而不必为每个浏览器手动运行相同的脚本,也不必为每个浏览器复制测试套件。 Essentially, using a "Resource.txt" file to tell the test to instantiate the browser the grid node is set up for.
本质上,使用“ Resource.txt”文件告诉测试实例化设置网格节点的浏览器。
For example, in a TestNG project (Using POM method) I use the "if" and "else" methods to tell the test to use the browser that the selenium grid node is set up for. 例如,在一个TestNG项目中(使用POM方法),我使用“ if”和“ else”方法来告诉测试使用浏览器设置了硒网格节点。
Python 2.7 RF 3.0.2 Grid 3.5 Python 2.7 RF 3.0.2网格3.5
The common way to do this is to use a variable to hold the name of the browser, and then set the variable from the command line 常用的方法是使用变量保存浏览器的名称,然后从命令行设置变量
In your test case: 在您的测试用例中:
open browser ${ROOT_URL} ${BROWSER}
From the command line: 在命令行中:
robot --variable BROWSER:firefox ...
-or-
robot --variable BROWSER:chrome ...
An alternative to setting the variable on the command line is to have your tests use a variable file which dynamically sets the value of the variable based on runtime conditions. 在命令行上设置变量的一种替代方法是让您的测试使用变量文件 ,该文件根据运行时条件动态设置变量的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.