Debugging python code when running Robot Framework tests

Development Environment Specification:

1) OS Specifics:
Description: Ubuntu 18.04.4 LTS

2) PyCharm 2019.3.3 (Community Edition);  Build # PC-193.6494.30, built on Feb 6, 2020; Runtime version: 11.0.5+10-b520.38 amd 64

3) Python 3.7.4;

4) Virtual Environment Specs:

(venv) (base) hakan@hakan-VirtualBox:~/Python/Robot/arguments-in-robot$ python -m pip list
Package Version
-------------- -------
pip 20.0.2
robotframework 3.1.2
setuptools 46.0.0
wheel 0.34.2

-------------------------------------------------------------------

THE OBJECTIVE: I have a robot test suite called named-arguments-tests.robot, and a Python module named ArgumentUtils.py. The robot test suite calls a keyword in the python module. I want to be able to hit a breakpoint in ArgumentUtils.py (in Python), when running a robot test suite in debug mode.

STEPS TO PRODUCE:

Please do the following on an Ubuntu Environment (1):

1. Clone the robot test project from this github repo

2. At the root of the project folder, install a virtual environment named venv, which is inline with the specifications (3) & (4)

3. In command prompt at project root, activate the venv using the command on the command prompt: source venv/bin/activate

3. Ensure that you installed the right PyCharm IDE given in (2)

4. Start the IDE, import the robot test project

5. Set Project Interpreter to point to the preset venv's python (i.e. /home/hakan/Python/Robot/arguments-in-robot/venv/bin/python) for the robot test project

   Refer to this picture for this step:

  

6. Create a new Run/Debug configuration as specified in the following picture:

 8. Put a breakpoint in ArgumentUtils.py as shown:

 9. Press Debug and see how it goes:

Expected Result: The breakpoint set in step 8 is hit.

Observed Result:

/home/hakan/Python/Robot/arguments-in-robot/venv/bin/python -m robot -L debug -d Results/ Tests/named-arguments-tests.robot /snap/pycharm-community/179/plugins/python-ce/helpers/pydev/pydevd.py --cmd-line --module --multiproc --qt-support=auto --client 127.0.0.1 --port 39889 --file Tests.ArgumentUtils
[ ERROR ] Parsing '/snap/pycharm-community/179/plugins/python-ce/helpers/pydev/pydevd.py' failed: Unsupported file format 'py'.

Try --help for usage information.

Process finished with exit code 252

 

P.S If you want to see if the environment you just set above works, then try running this command at your project root in command prompt:

(venv) (base) hakan@hakan-VirtualBox:~/Python/Robot/arguments-in-robot$ python -m robot -L debug -d Results/ Tests/named-arguments-tests.robot

 

Any help is sincerely appreciated! Note that i am not trying to set a breakpoint to robot file (i know there is currently no such support), but my breakpoint is in Python code and I cant debug my Python code :(

 

 

 

Please sign in to leave a comment.