dimanche 5 avril 2015

How to force tests to stop running a test suite after a specified test failed?

I have a test suite written in Selenium Webdriver/Python 2.7 consisting of several test cases. Some of test cases are so critical that if they fail the whole test is failed and there is no need to run test cases after that.



class TestSuite1(unittest.TestCase)
def setUp(self):
pass

def test1(self):
return True

def test2(self):
return false

def test3(self):
return True

# This is a critical test
def test4(self):
return false

def test5(self):
return True

def tearDown(self):
pass


So, I want to stop the whole test run when test4 fails (test run should continue when test2 fails) because it is critical. I know we can use decorators but I am looking for a more efficient way since I have about 20 critical tests in my test run and it does not seem efficient to use 20 flag for all test cases.


Aucun commentaire:

Enregistrer un commentaire