Traditional Culture Encyclopedia - Traditional stories - Unit test to measure one branch or multiple branches
Unit test to measure one branch or multiple branches
Unit testing measures multiple branches.
Unit tests are really white-box tests, where the developer knows the logic of their code, so they want to test as many logical branches or execution paths as possible.
In a traditional structured programming language like C, the unit to be tested is typically a function or sub-procedure. In an object-oriented language like C++, the basic unit of testing is the class. For Ada languages, developers can choose whether to perform unit testing at the level of standalone procedures and functions, or at the level of Ada packages.
Basic Information
A unit test (module test) is a small piece of code written by a developer to verify that a very small, well-defined piece of functionality of the code under test is correct. Typically, a unit test is used to determine the behavior of a particular function under a particular set of conditions. For example, you might put a very large value into an ordered list and confirm that the value appears at the end of the list.
Unit testing is done by the programmer, and ultimately benefits the programmer. It can be argued that the programmer's responsibility to write functional code carries with it the responsibility to write unit tests for his own code. Unit tests are executed to prove that the code behaves as we expect it to.
- Related articles
- How are fruit tree germplasm resources distributed?
- Methods and Skills of Poetry Teaching in Kindergarten
- classic chinese poetry
- Chinese idiom stories
- Couplets of inspirational slogans for swearing in the senior high school entrance examination for 100 days
- What offerings should be placed on the altar of Lafayette?
- How to make delicious fragrant and tender tofu, fragrant and tender tofu.
- The pattern of difference order in rural areas of China
- What does the emulsification technology used in general fish oil mean?
- What are the energy-saving features of Huizhou architecture?