I have trouble running my test case from a unit test suite. The problem is that I am defining driver in a setup-metod and not in the test it self. My code is following
the suite:
import unittest
from pobocky import TestPobocky_D
def suite():
suite = unittest.TestSuite()
#suite.addTest(TestPobocky_D("setup_method"))
suite.addTest(TestPobocky_D('test_pobocky_D'))
return suite
if __name__ == '__main__':
runner = unittest.TextTestRunner()
runner.run(suite())
The test_pobocky_D looks like this
class TestPobocky_D(unittest.TestCase):
def setup_method(self, method):
self.driver = webdriver.Chrome(ChromeDriverManager().install())
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def test_pobocky_D(self):
self.driver.get(URL_pobocky)
acceptConsent(self.driver)
self.driver.maximize_window()
... test
the error I get is : AttributeError: 'TestPobocky_D' object has no attribute 'driver' Can somehow help me how to solve that please ? How can I include the setup_method in the runner so it works? If I put the definition of driver into test_pobocky_D it works but I need the setup metod cuz I will most likely be using remote driver in the future and changing it will be easier that way.
Thanks in advance for any ideas or help