I have a Test suite using Python with unittest, I want to skip set of test cases on the basis on previous Test case run result, for instance if First Test case fails i want to set a Boolean variable and execute next test case on the basis on that boolean flag value, but some how the Boolean Flag value is not being read in skipIf decorator and Test suite is still executing the unwanted cases, below is the snippet of code:
FlagMain = False
FlagSet1 = False
FlagSet2 = False
class Gui_Automation_PSS16II_GT_ElectricalConstraint_UseCase(unittest.TestCase):
def setUp(self):
print("----Automation starting----")
logger.info("----Automation starting----")
def test111_LaunchApplication(self):
try:
FlagMain = False
except:
FlagMain = True
assert False
@unittest.skipIf(FlagMain == True ,'Launch Application Test Case Failed')
def test112_Import_Open_NewDesign(self):
logger.info("--Entered--")
try:
FlagSet1 = False
except:
FlagSet1 = True
assert False
@unittest.skipIf(( FlagMain == True or FlagSet1 == True),"Launch Application Test Case Failed or Import Design Failed")
def test113_StatusCheck_OpenDesign(self):
try:
FlagSet1 = False
except:
FlagSet1 = True
in above example if my first test case throws any exception then i want to set boolean flag as false and second and third test case should be skipped, same for second test case on the basis on FlagSet1 value i want to control remaining test case execution.
Could some please tell em why the test cases are not being skipped?
Aucun commentaire:
Enregistrer un commentaire