I write Selenium tests, and have a problem. Before each test I upload different files for every test, and after test is done, I want to remove these files from application even if test failed. There are two methods setUp
and tearDown
. They are called before and after every test, but how can I define which test was finished in the tearDown
method? It is important for me, because after each test I want to remove different files from application, depending on the finished test.
I want something like:
def tearDown(self):
if test1_is_finished():
remove_test1_files
if test2_is_finished():
remove_test2_files
# and so on
I am new to Python and Selenium tests, and maybe a better approach exists to do some job after after the test was finished, even if it failed.
Aucun commentaire:
Enregistrer un commentaire