How to not use some block of code of teardown method after every testcase? #1632
-
Hello Sir, I am using the Delete method of CRUD operation for deleting data from firebase in teardown method . But i don't want to delete that for every testcases, instead of that i want to delete for some testcases. So, what can i do? The below block of code i added in teardown method. But i dont want to execute this after end of test case for some specific test case.
Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Using this format: https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md#sb_sf_02 you can easily customize your |
Beta Was this translation helpful? Give feedback.
-
Okay, sir got it but if I set variable for example,
then i have to mention this variable in every test case if i want to delete the channel and if I don't want to delete then need to mention
is that right? Because if i don't mention "self.delete_channel = False" in other test cases it throws an error |
Beta Was this translation helpful? Give feedback.
-
got it . i set "self.delete_channel =False" in tear up method, so default it takes False |
Beta Was this translation helpful? Give feedback.
Using this format: https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md#sb_sf_02 you can easily customize your
tearDown()
method. Set a variable in your tests that you will access in yourtearDown()
method to determine if you need to run custom code. (Eg. In a test:self.my_var = 1
... In the tearDown():if self.my_var == 1:
...)