RobotFramework-在不同环境下运行测试 [英] RobotFramework - Run Tests on different environments
问题描述
我需要针对特定的环境QA,Dev,Test等运行特定的测试,我在不同的测试上放置了标签,我希望在不同的环境上运行,我在移动设备上工作时使用的是AppiumLibrary,考虑使用文本文件以及所有需要在特定环境下执行的所有变量.
I need to run specific tests for specific environments QA, Dev, Test etc., I have put a Tag on different tests i want to run on different, I am using AppiumLibrary as I am working on a mobile device, I was thinking to use a text file with all variables i need to execute for specific enviroments something like this.
--variable Env:http://example.test.com:1111
--variable remoteUrl:http://127.0.0.1:123/web/hub
--variable platformVersion:8.0
--variable platformName:Android
--variable deviceName:Samsung
--variable automationName:appium
--variable appPackage:SamplePackage
--variable appActivity:Activity
--variable noReset:True
我需要通过此配置才能使我的应用程序运行到环境中,是否可以在机器人框架中使用-variables
或是否有更好的方法来在特定环境下运行测试环境?
I need to pass this configuration in order for my app to hit the environment, Is there are way to use the --variables
inside robot framework or is there a better approach to run tests on specific environments?
推荐答案
如果我理解您的问题,您所需要做的就是将该文件作为-argumentfile
选项的值传递.我的团队使用了那个文件.我们有名为 smoke.args
, prod.args
等的文件.我们这样使用它们:
If I understand your question, all you need to do is pass that file as the value of the --argumentfile
option. My team uses files that that. We have files named smoke.args
, prod.args
, etc. We use them like this:
robot --argumentfile dev.args tests
这样,文件中的任何变量都可以像其他变量一样在测试中访问.
With that, any variables in the file are accessible in your tests just like any other variables.
这篇关于RobotFramework-在不同环境下运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!