Hello,
I have been asked about how to run the UITests and Python scripts that
use UNO API in general in PyCharm. I have documented the process in this
section of the IDE article:
Developmenet/IDE
https://wiki.documentfoundation.org/Development/IDE#PyCharm
This is the command line for running a UITTest as you see in PyCharm
console, in which works fine for me:
--------------------------------------------------------------------------------
/usr/bin/python3.8
/home/hossein/Projects/libreoffice/core/uitest/test_main.py
--soffice=path:/home/hossein/Projects/libreoffice/core/instdir/program/soffice
--userdir=file:///tmp/libreoffice/4
--file=/home/hossein/core/sc/qa/uitest/sort/stableSorting.py
--------------------------------------------------------------------------------
The same process works for debugging Python scripts that work with UNO
API. You just have to press the debug button from the toolbar. On the
other hand, one can not use the "Debug" button in PyCharm to debug the
script, as it leads to error:
--------------------------------------------------------------------------------
/usr/bin/python3.8
/snap/pycharm-community/278/plugins/python-ce/helpers/pydev/pydevd.py
--multiprocess --qt-support=auto --client 127.0.0.1 --port 34797 --file
/home/hossein/Projects/libreoffice/core/uitest/test_main.py
--soffice=path:/home/hossein/Projects/libreoffice/core/instdir/program/soffice
--userdir=file:///tmp/libreoffice/4
--file=/home/hossein/Projects/libreoffice/core/sc/qa/uitest/sort/stableSorting.py
Connected to pydev debugger (build 221.5591.52)
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in
_find_and_load_unlocked
ModuleNotFoundError: No module named 'uitest.framework'
Process finished with exit code 1
--------------------------------------------------------------------------------
As you can see, there are several Python scripts involved here:
1) plugins/python-ce/helpers/pydev/pydevd.py for debugging
2) uitest/test_main.py for running the UITest
3) sc/qa/uitest/sort/stableSorting.py the actual UITest
Any idea how to fix this problem?
Regards,
Hossein