Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import unittest
- from selenium import webdriver
- # Base Selenium Test class from which all test cases inherit.
- class BaseSeleniumTest(unittest.TestCase):
- def setUp(self):
- self.browser = webdriver.Firefox()
- def tearDown(self):
- self.browser.close()
- import unittest
- import test_example
- if __name__ == "__main__":
- SeTestSuite = test_example.TitleSpelling()
- unittest.TextTestRunner(verbosity=2).run(SeTestSuite)
- from base import BaseSeleniumTest
- # Test the spelling of the title
- class TitleSpelling(BaseSeleniumTest):
- def test_a(self):
- self.assertTrue(False)
- def test_b(self):
- self.assertTrue(True)
- Traceback (most recent call last):
- File "H:Pythontestframeworkmain.py", line 5, in <module>
- SeTestSuite = test_example.TitleSpelling()
- File "C:Python27libunittestcase.py", line 191, in __init__
- (self.__class__, methodName))
- ValueError: no such test method in <class 'test_example.TitleSpelling'>: runTest
- SeTestSuite = unittest.defaultTestLoader.discover(start_dir='.')
- # if your line didn't work
- unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(SeTestSuite))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement