RobotFramework - 在不同环境下运行测试 [英] RobotFramework - Run Tests on different environments

查看:33
本文介绍了RobotFramework - 在不同环境下运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为特定环境 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.argsprod.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆