This is my code;
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setup(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(5)
def teardown(self):
self.browser.quit()
def test_can_start_list_and_retrieve_later(self):
# checkout the homepage
self.browser.get('http://127.0.0.1:8000')
# check title and header
self.assertIn('To-Do', self.browser.title)
self.fail('Finish the test')
if __name__ == '__main__':
unittest.main(warnings='ignore')
which results in the following error:
$ python3 functional_tests.py
E
======================================================================
ERROR: test_can_start_list_and_retrieve_later (__main__.NewVisitorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "functional_tests.py", line 15, in test_can_start_list_and_retrieve_later
self.browser.get('http://127.0.0.1:8000')
AttributeError: 'NewVisitorTest' object has no attribute 'browser'
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
the code is taken from TDD with python
My code matches with what has beeen written in the tutorial but should produce an assertIn error as the page has yet to be set up. Any help would be appreciated.