Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import unittest
  2. from selenium import webdriver
  3.  
  4. # Base Selenium Test class from which all test cases inherit.
  5. class BaseSeleniumTest(unittest.TestCase):
  6. def setUp(self):
  7. self.browser = webdriver.Firefox()
  8. def tearDown(self):
  9. self.browser.close()
  10.  
  11. import unittest
  12. import test_example
  13.  
  14. if __name__ == "__main__":
  15. SeTestSuite = test_example.TitleSpelling()
  16. unittest.TextTestRunner(verbosity=2).run(SeTestSuite)
  17.  
  18. from base import BaseSeleniumTest
  19.  
  20. # Test the spelling of the title
  21. class TitleSpelling(BaseSeleniumTest):
  22. def test_a(self):
  23. self.assertTrue(False)
  24.  
  25. def test_b(self):
  26. self.assertTrue(True)
  27.  
  28. Traceback (most recent call last):
  29. File "H:Pythontestframeworkmain.py", line 5, in <module>
  30. SeTestSuite = test_example.TitleSpelling()
  31. File "C:Python27libunittestcase.py", line 191, in __init__
  32. (self.__class__, methodName))
  33. ValueError: no such test method in <class 'test_example.TitleSpelling'>: runTest
  34.  
  35. SeTestSuite = unittest.defaultTestLoader.discover(start_dir='.')
  36.  
  37. # if your line didn't work
  38. unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(SeTestSuite))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement