SetUp/tearDown executed in wrong order

118
August 21, 2021, at 7:00 PM

I tried using setup and teardown concept with selenium webdriver, but getting output in unexpected order.

import unittest
from selenium import webdriver

def setUpModule():
    print("Setup module worked")

def tearDownModule():
    print("Teardown module worked")

class test(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        print("Setup class method executed at the start")
    @classmethod
    def setUp(self):  # execute everytime before every test method
        print("Setup worked")
        self.driver = webdriver.Chrome(
            executable_path="*****\\chromedriver.exe")
    @classmethod
    def tearDown(self):  # executed everytime after every test method over
        print("teardown worked")
        self.driver.close()
    @classmethod
    def tearDownClass(cls):
        print("Teardown method executed at the end")
    def test_google(self):
        self.driver.get("https://www.google.com/")
        print("Title of the page"+self.driver.title)
        print("Google")
    def test_facebook(self):
        self.driver.get("https://www.facebook.com/")
        print("Title of the page"+self.driver.title)
        print("Facebook")
if __name__ == "__main__":
    unittest.main()

output:

Setup module worked
Setup class method executed at the start
Teardown method executed at the end
Teardown module worked
Process finished with exit code 0
Setup worked
Title of the pageFacebook - facebook
Facebook
teardown worked
Setup worked
Title of the pageGoogle
Google
teardown worked
READ ALSO
React renders based on state change but not on prop change?

React renders based on state change but not on prop change?

The reason I'm having this question is that I do not see how React renders based on prop changes

80
Format XML ordered list with XSLT

Format XML ordered list with XSLT

I have the following XML-Snippet …

58
How should I get all the messages from my database and return it

How should I get all the messages from my database and return it

I'm making a chat app with Java and I'm getting all the messages to a specific chatroomThe issue is I don't know how to put them all in one array or something so it can be returned all at once to the user

69
Is there a way of mirroring an inheritance relationship using spring-boot-starter-data-elasticsearch?

Is there a way of mirroring an inheritance relationship using spring-boot-starter-data-elasticsearch?

I am new to Elasticsearch and spring-boot-starter-data-elasticsearch

104