Run given process from Terminal using Robot Framework

Problem:- How to execute external files (say test.py) as process using robot framework?

Solution:-

Approach 1 :- Using Run Process keyword, under “Process” library

Step1:- Include “Process” library in settings

Process library in robot framework


Step2:- Use “Run Process” keyword as below

Comment Using Run Process Keyword
${result} = Run Process python -c print 'Hello, world!'
Should Be Equal ${result.stdout} Hello, world!
Comment Using Run Keyword
${output} Run python ${EXECDIR}/Resources/Lib/data-generator/mqttgen.py 10 10 10


Approach 2 :- Using “Run” keyword under “Operating System” library

Step1:- Include “OperatingSystem” library in settings
Step2:- Use “Run” process keyword.

Example below we used our test data generator(third party .py file) to be triggered by Robot framework/

Run process example in robot framework



Learn Robot Framework

ufthelp

Leave a Reply

Your email address will not be published. Required fields are marked *