Is there a standard method to check if all functions of all files that are included in a test have a testcase? So if I have script_1.py, script_2.py and script_3.py with corresponding test_script_1.py, test_script_2.py and test_script_3.py, how can I check that every function in script_x.py gets called at least ones by the test scripts?
I wrote the test functions in the format def test<Name_of_function>_<test_condition> so for example the function def sum(a, b) has test functions def testSum_valid_input and def testSum_invalid_input, so I could write a script that gets all the function names from the test scripts and compare that to the functions in the tested scripts, but I am hoping that there is already an easy way to do this.
The best way is probably to use a coverage tool. It will tell you how much of your code is called at least one time by a test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With