1

Problem statement:

Unable to pass multiple variable values to my test case using CumulusCI command:

cci task run robot...

Sample Code:

*** Settings ***
Resource  C:/Dev/myproject/robotframework/EnvironmentSetupFile.robot
Suite Setup  Run Keywords  Suite Setup KW1  AND  Suite Setup OS And Browser  ${LocalOrRemote}  ${Browser}


*** Test Cases ***
Verify whether I am able to set environment and browser
    [Tags]  LocalEdge
    [Documentation]  This test should run on the local edge browser
    Keyword X
    Keyword Y


*** Keywords ***
Suite Setup KW1
    do something
Suite Setup OS And Browser
    [Arguments]  ${LocalOrRemote}  ${Browser}
    Log Many  ${LocalOrRemote}  ${Browser}
    run keyword if  '${LocalOrRemote}'=='Local'  Setup Local Browser  ${Browser}  
    ...  ELSE IF  '${LocalOrRemote}'=='Remote'  Setup Remote Browser  ${Browser}
    ...  ELSE  FAIL  "Incorrect environment value passed! Please refer the instructions in README for running the test suite"

Command I am using to invoke my test:

cci task run robot -o suites mypath/MyTestFile.robot -o include LocalEdge -o vars LocalOrRemote:Local,Browser:edge

Issue I am facing:

The value of ${Browser} is not received as edge but defaulted to chrome, which means the command is not able to pass on my desired value to the TC.

KEYWORD BuiltIn . Log Many ${LocalOrRemote}, ${Browser}
Documentation:  
Logs the given messages as separate entries using the INFO level.
Start / End / Elapsed:  20190522 16:36:53.877 / 20190522 16:36:53.878 / 00:00:00.001
16:36:53.877    INFO    Local   
16:36:53.877    INFO    chrome

Notes:

  1. I am referring this section for building my command: https://cumulusci.readthedocs.io/en/latest/tasks.html#id49

  2. If I have to pass just one variable in the same way as above, say for eg. just LocalOrRemote, then the code works perfectly fine, so it appears that this has to do something with the way I am passing multiple variables.

  3. My test automation tech stack is Robot Framework, CumulusCI, Selenium

Please guide me.

4
  • There doesn't look like anything directly related to salesforce in this question. You will probably get a better response in other forums. – Keith C May 22 '19 at 12:13
  • 1
    CumulusCI is a Salesforce.org continuous integration product. It encourages the use of Robot browser automation. (I'm on the team that builds CCI; I don't know the answer to this question but will ask around). – David Reed May 22 '19 at 12:26
  • @DavidReed Woops, didn't realize it was a Salesforce focussed product. Would be interested to see a comment or two in Why CumulusCI? on why you didn;t build on top of other CI products. – Keith C May 22 '19 at 13:57
  • Found the workaround to this issue and posted it here – vish4444 May 28 '19 at 5:56
2

How to pass multiple arguments to a test case in CumulusCI test automation framework?

The way you are doing it is the correct way: -o vars var1:value1,var2:value2

Here's a really simple example:

*** Test cases ***
Example
    Should be equal  ${LocalOrRemote}  Local
    Should be equal  ${Browser}        edge

Save that to a file and then run it with the robot task like this:

cci task run robot -o vars LocalOrRemote:Local,Browser:edge -o suites example.robot 

You will see that the variables are initialized properly. If the wrong browser is opening up, one of your libraries must be changing the value of the ${Browser} variable without you realizing it.

In this answer on stackoverflow which you provided to your own question, you stated you've solved the problem by re-ordering your imports. That says to me that there's some code in one of your libraries or resource files that is changing the browser variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.