Reference: Https://docs.python.org/3.4/library/unittest.html#module-unittest
A picture solves the problem:
Covers 5 pieces of content: case, Suite, loader, runner, result
1 Case:
TestCase (test Case): The basic class for all test cases, give the name of a test method, and return a test case instance.
2 Suite:
TestSuite (test suite): Organize instances of test cases, support the addition and deletion of test cases, and eventually pass to Testrunner for test execution
3 Loader:
Testloader (test Case loader): A test case loader that includes multiple methods for loading test cases. Return a test suite
4 Runner:
Texttestrunner (test Case execution): an instance of a test case execution in which run (test) executes the run (Result) method in Testsuite/testcase
Texttestresult (use case result record): The results of the test are saved to the Texttestresult instance, including how many test cases were run, how many succeeded, how many failed, etc.
5 result
TestResult (test result): Record the final result of the test
Python Learning 6 Unit test Framework-unittest