For example I want to write several tests cases like this
class Test(APITestCase):
def setUp(self):
....some payloads
def test_create_user(self):
....create the object using payload from setUp
def test_update_user(self):
....update the object created in above test case
In the example above, the test_update_user
failed because let's say cannot find the user object. Therefore, for that test case to work, I have to create the user instead test_update_user
again.
One possible solution, I found is to run create user in setUp
. However, I would like to know if there is a way to chain test cases to run one after another without deleting the object created from previous test case.