Skip to content Skip to sidebar Skip to footer

How To Execute Robot Testcase From Eclipse Which Takes Command Line List Arguments As Input?

I have written a Robot test case which takes input list from command line. I ran the test case from command line and it executed successfully. All the issue comes when i run the sa

Solution 1:

When running your example I was not able to replicate your results. Instead I observe the desired behavior. Below are the settings I used.

firstTest.robot

*** Settings ***
Library    String    

*** Test Cases ***

TC
    [Tags]    TestCLI   
    Log    ${my_vars}
    @{list_of_vars}    Split String    ${my_vars}
    Log   @{list_of_vars}[0]
    Log   @{list_of_vars}[1]

The additional command line variables -v my_vars:one,two -E space:, need to be set on the run configuration. enter image description here

This then results in the following message log:

Starting test: RunWithVars.firstTest.TC
20180404 20:45:06.445 : INFO : one two
20180404 20:45:06.447 : INFO : @{list_of_vars} = [ one | two ]
20180404 20:45:06.448 : INFO : one
20180404 20:45:06.449 : INFO : two
Ending test: RunWithVars.firstTest.TC

And console log. I've seperated the command into seperate lines and removed some of the --listener folder path for readability.

Command: C:\Python\RF_P27\Scripts\python.exe 
 -m robot.run 
 --listener C:\Users\..\TestRunnerAgent.py:51805 
 -s RunWithVars.FirstTest 
 -v my_vars:one,two -E space:, C:\TA\W\StackOverflow\RunWithVars
Suite Executor: Robot Framework 3.0.2 (Python 2.7.13 on win32)
==============================================================================
RunWithVars                                                                   
==============================================================================
RunWithVars.firstTest                                                         
==============================================================================
TC                                                                    | PASS |
------------------------------------------------------------------------------
RunWithVars.firstTest                                                 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
RunWithVars                                                           | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  C:\TA\W\StackOverflow\RunWithVars\output.xml
Log:     C:\TA\W\StackOverflow\RunWithVars\log.html
Report:  C:\TA\W\StackOverflow\RunWithVars\report.html

Post a Comment for "How To Execute Robot Testcase From Eclipse Which Takes Command Line List Arguments As Input?"