Python Unittest
first you should import unittest, and write a class inherit unittest.TestCase. Then write some function named test_XXX, which uses "test_" as its prefix. Then in main, call the class's main() function.
this is an example:
1 | import unittest |
In this example, TestFunctions.main() will call all functions like test_XXX between setUp() and tearDown(). The sequence is setUp()--->test_XXX()--->tearDown()--->setUp()--->test_XXX()--->tearDown().....