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

adding2bprocess2blibrary2bin2brobot2bframework-4634895


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/

run2bprocess2bkeyword2bin2brobot2bframework-6820729

Learn Robot Framework

Was this article helpful?
YesNo

Similar Posts