pythonselenium-webdriverrobotframeworklibraries

Executing a Python File from Robot Framework using Process Library


I am trying to execute a python file from Robot Framework using the Process Library as follows:

Example Test Case
    OperatingSystem.Should Exist    ${CURDIR}/../../../../../server.py
    Start Process    python.exe ${CURDIR}/../../../../../server.py    alias=PythonServer

The OperatingSystem.Should Exist is passing but the Start Process line is failing. I am getting the error: FileNotFoundError: [WinError 2] The system cannot find the file specified

I have also tried giving the absolute path following python.exe but that also is giving the same error. I have also tried giving the absolute path of my python.exe

What is the right syntax to execute a python file from Robot Framework using the Process Library?


Solution

  • You missed the separation of the program and its arguments.

    Here is an example:

    *** Settings ***
    Library           Process
    Library           OperatingSystem
    
    *** Test Cases ***
    Example Test Case
        OperatingSystem.Should Exist    ${CURDIR}/../wx_html_image.py
        Start Process    python    ${CURDIR}/../wx_html_image.py    alias=PythonServer
    
    

    As you can see on the Start Process documentation, the *arguments are separated: RIDE Text Editor with Test Case and Start Process doc