Search code examples
variablesappiumrobotframework

RobotFramework - Run Tests on different environments


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

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?


Solution

  • 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.