Best way to assert unit test cases with many conditions
Ganesh Pal
ganesh1pal at gmail.com
Wed Jul 19 06:26:32 EDT 2017
>
> Yes. Just assert each thing as it needs asserting.
>
>
Asserting each sub test will fail the entire test, I want the to pass
the test if any the sub test passes. If the sub test fail try all cases
and fail for the last one.
Example :
def test_this(self):
if Sub_test_1():
#passes then PASS the Complete test i.e. test_this() and If
sub_test_1() fail then run further subtest!)
elif run sub_test_2() :
#Then PASS test_this() and don't run next test i.e
sub_test_3(),sub_test_4() etc)
elif run sub_test_3()
if sub_test_3()
# Then pass test_this() and don't run next test i.e. sub_test_4()
,sub_test_5(). etc)
Regards,
Ganesh
More information about the Python-list
mailing list