Robot framework permutate same steps with different value

I need to permutate drop down list value by using python robot framework in py charm.

I have installed appium library but I do not know how do I achieve permutation set of value.

Should I keep them in variables or keywords?

Example:

  • Step 1 Tap createnew
  • Step 2 Tap boxA valueA
  • Step 3 Tap boxB value1
  • Step 4 Tap add

Then new case step 1 and 4 same. Step 2 and 3 use valueB,C,D and value2,3,4. … Total of 20 cases with different values.

Answer

I would definitely go with keywords. You have well defined tasks that you want to execute multiple times in multiple test cases. You could have something like this:

*** Keywords ***
Create New
    Tap    createnew

Interact Box A
    [arguments]    ${value}
    Tap    boxA
    Enter     ${value}


Interact Box B
    [arguments]    ${value}
    Tap    boxB
    Enter     ${value}

Add
    Tap    add

or even

Interact Box
    [arguments]    ${box_id}    ${value}
    Tap    ${box_id}
    Enter     ${value}

If you would like to reuse these in multiple robot files, you can place them into a resource file as well.

Now as for the test cases, you could create a test template:

*** Keywords ***
Template test
    [arguments]    ${valueA}    ${valueB}
    Create New
    Interact Box A    ${valueA}
    Interact Box B    ${valueB}
    Add

*** Test Cases ***
My Test
    [Template]    Template test
    valueA=X    valueB=1
    valueA=Z    valueB=12
    valueA=S    valueB=13
    valueA=D    valueB=14
    valueA=B    valueB=15

Or you can use the Data-driven approach or you could use the DataDriver library to feed the test data from a file.