unit testing is the examination and verification of the smallest testable unit in software. There is no clear standard for the size or scope of a “unit,” which can be a function, method, class, functional module, or subsystem.
Unit testing is often associated with white-box testing, although conceptually the two are different, but what we commonly call “unit testing” and “white-box testing” are both considered to be related to code, so in some context they are often considered to be the same thing. Another way to think about it is that unit testing and white box testing are tests of code written by developers.
Hint: Concept this thing roughly understand what meaning can ~
Who will do the unit testing?
Think about it: as we explained earlier, unit testing is simply the testing of code written by developers. Since it is related to code, our first feeling is that it should be done by developers. Given that unit tests contain the word “test,” “testers do it” makes sense.
Unit testing is usually done by developers or testers. There is no absolute standard for who should do it. It depends on the actual situation of the company. Let’s look at the advantages and disadvantages of unit testing as a developer or tester:
Developers do unit testing:
Advantages: Developers are most familiar with the code, and developers have relatively strong programming skills, so developers writing their own unit tests is more efficient and has higher coverage
Cons: Developers spend a lot of time writing business code and sometimes don’t have time to write unit tests. Also, most developers don’t have a good idea of testing, and unit testing can be as simple as writing a use case; Write their own code to measure, often are unreliable!
Testers do unit tests:
Advantages: Testers have more systematic testing ideas, which can better ensure the coverage of use cases. In addition, by writing a single test, you can better understand the specific code structure and process, which is also very beneficial for the subsequent business testing.
Cons: The tester’s programming skills are relatively weak, and unit testing cannot be done without different programming. And testers are not familiar with the code developers, the efficiency will be relatively low.