Please see the code below. I was trying to implement a test suite for my project
import unittest
class TestClass1(unittest.TestCase):
def test_1_first(self):
print("First test case")
def test_2_second(self):
print("Second test case")
class TestClass2(unittest.TestCase):
def test_3_third(self):
print("Third test case")
def test_4_fourth(self):
print("Fourth test case")
if __name__ == "__main__":
# val = 1 <-- getting from user
# if val == 1:
# Execute test cases in TestClass2
# else
# Execute test cases in TestClass1\
unittest.main()
I will get the class name as command line argument and I need to run each class of test according to the argument. Means I need to select and run some classes of test cases on runtime. So can any one help me to prevent a class from unit test execution at runtime? The problem is It's not allowed to use the method like passing class name while execution