appunittest2.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # File Name: appunittest2.py
  2. # Modified Date: March 24, 2017
  3. # Description: This class is for testing message of show error function.
  4. # Method Level Comment: Python Convention (inside function)
  5. __author__ = "Inyoung Choung"
  6. import os
  7. from os import path
  8. import unittest
  9. from implementation import Impl
  10. # testing Show Error function.
  11. class testShowError(unittest.TestCase):
  12. def runTest(self):
  13. """
  14. run Test to check if result is equal to initialized string.
  15. :return:
  16. """
  17. # initialize value to message variable.
  18. message = str("Here is a test warning message.")
  19. # pass the predefined message into alert_message function.
  20. result = Impl.display_message(self, message)
  21. import app
  22. # testing Show Error function
  23. class testShowError(unittest.TestCase):
  24. def runTest(self):
  25. # initialize value to message variable.
  26. message = str("Here is a warning message.")
  27. # pass the predefined message into alert_message function.
  28. result = app.alert_message(message)
  29. # check if the two values in the parameter are matched.
  30. self.assertEqual(result, message)
  31. # class starter
  32. if __name__ == '__main__':
  33. unittest.main()