Christof Vermeersch Christof Vermeersch - 4 months ago 21
Python Question

Run multiple unittest tes tfiles at once

In my project I created a unittest test file for each Python file. For example, I have file

component.py
and its accompanying
test_component.py
. Similarly for
path.py
and
test_path.py
, etc.

However, since these files depend on each other it is possible that a change in one file affects another, thus if I change something I need to rerun all my testfiles. For now, I have to do this manually. Is it possible to run all these test files at once with only one handling? Maybe call them from an extra file? I want however still use the testsuite as before (see the image below).

I am using Python 2.7 and JetBrains' PyCharm.

enter image description here

Answer

It's possible to run all tests located in some folder.

Go to Run - Edit Configurations, select or create run configuration for tests and specify path to folder.

enter image description here