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.
I would recommend using Pytest .
Another alternative is to have a separate file that calls tests or instantiates classes from each test file. Based on the returns it calls the next test.
You also might have a need store information in a .txt file. You could write and read to a file that holds your test variables, conditions, etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.