Guest User

Untitled

a guest
Aug 27th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. UnitTest in Python [closed]
  2. import unittest
  3.  
  4. class BzTestSe(unittest.TestCase):
  5. DEFAULTUSERNAME = 'username-a2'
  6. DEFAULTPASSWORD = 'pass'
  7. DEFAULTHOST = 'localhots'
  8.  
  9. def __init__(self,username=DEFAULTUSERNAME, password=DEFAULTPASSWORD, host=DEFAULTHOST):
  10. super(unittest.TestCase,self).__init__()
  11. self.username=username
  12. self.password=password
  13. self.host=host
  14.  
  15. class test_se_topwebsite(BztTestSe):
  16. def setUp(self):
  17. print "setup"
  18.  
  19. def test_test_se_topwebsite(self):
  20. self.fail()
  21.  
  22. Traceback (most recent call last):
  23. File "<stdin>", line 1, in <module>
  24. File "testsuite/test_se.py", line 10, in __init__
  25. super(unittest.Testcase,self).__init__()
  26. File "/usr/lib/python2.7/unittest/case.py", line 184, in __init__
  27. (self.__class__, methodName))
  28. ValueError: no such test method in <class 'testsuite.test_se.BztTestSe'>: runTest
  29.  
  30. import unittest
  31.  
  32. class TestSomething(unittest.TestCase):
  33.  
  34. def setUp(self):
  35. self.message = "does this work"
  36.  
  37. def test_message_is_expected(self):
  38. self.assertEquals("does this work", self.message)
  39.  
  40.  
  41. if __name__ == '__main__':
  42. unittest.main()
Add Comment
Please, Sign In to add comment