background image

Other Ways to Run Tests

import unittest

class 

TestBuiltins

(

unittest.TestCase

):

    

"""Test some python built-in method"""

    def 

test_len

(self):

        self.assertEqual(5, len("hello"))
        self.assertEqual(3, len(['a','b','c']))

if __name__ == "__main__":
    unittest.main()

1. Let the IDE run them for you.
2. Use a test script or build tool.
3. Add a "main" script to end of your Test class...

Comments:

Unit Testing in Python

navigate_before navigate_next