Why teardown_suite method doesn't accept parameters

22 views
Skip to first unread message

Nikhil Vyas

unread,
May 7, 2021, 12:09:25 PM5/7/21
to lemoncheesecake
Hi Everyone,
I am working on a automation code with lcc but I am unable to pass any parameters like selenium driver / string to the tear_down method , where as the same is applicable for setup_suite is this know functionality and is there a possible work around for the same.

Any help and suggestions would be appreciated and welcomed.

akshaym...@gmail.com

unread,
Aug 30, 2021, 3:14:55 AM8/30/21
to lemoncheesecake
As per http://docs.lemoncheesecake.io/en/latest/tests-and-suites.html#setup-and-teardown-methods, teardown signature looks like this: teardown_test(test, status). Does that answer your question?

Nicolas Delon

unread,
Aug 30, 2021, 4:35:46 PM8/30/21
to lemoncheesecake
Hello,

Well, it depends on your needs. First you can have a teardown phase on the fixture itself:

@lcc.fixture()
def browser():
    browser = [some kind of browser creation code]
     yield browser
     browser.quit()


Secondly, if you use a class as a test suite, you can keep track of the fixture in your setup_suite and then use it in the teardown_suite:
@lcc.suite()
class MySuite:
    def setup_suite(self, browser):
        self.browser = browser

   [ ... some tests ... ]

    def teardown_suite(self):
       [... do something with self.browser .... ]


I hope it answers your question.

Regards,

Nicolas.
Reply all
Reply to author
Forward
0 new messages