1. Basic Concepts
Unit test-Used to verify that there is no problem with some aspect of the function
Test Cases-a set of unit tests that verify the behavior of the function in all situations meets the requirements
Full coverage test Case-includes a complete set of unit tests that cover a variety of possible function usage patterns
2. Test function
Steps
Import UnitTest and Source functions
Create a test class that inherits from UnitTest. TestCase, and the class name starts with test
Write a test method, test the source method, and the test method should end with an assertion method
Execute the Unittest.main () method
3. Test class
Steps
Import UnitTest and source classes in the same package
Create a test class that inherits from UnitTest. TestCase, and the class name starts with test
You can write the setup (self) function, where you create the object of the source class, and you can directly "self" in each test method. Reference source object, no more new in each test method
Write a test method, test the method of the source class, and the test method should end with an assertion method
Execute the Unittest.main () method
4. Advanced Data
Selenium2+python Automation 51-unittest Introduction
Selenium2+python Automated 52-unittest execution sequence
Selenium2+python Automated 53-unittest Batch execution (Discover)
Selenium2+python Automated 54-unittest Generation Test report (Htmltestrunner)
Selenium2+python Automation 55-unittest (@classmethod)
Assertion of Selenium2+python Automation 56-unittest (Assert)
Python Automated test-unittest