Unit Test and Integration Test
Background
It is the first time that I try to write an article in English.
In the past, I didn’t write test code. Just thinking QA is responsible for testing.
As a developer, I don’t need to care about tests.
Although I know tests are essential, I can’t be aware of their importance.
After I joined my current team, it is required for developers to write tests.
So I have to write tests code.
After 8 months, I realize that tests are critical. I need to enforce my ability of testing.
therefore, I recently read a book Vladimir Khorikov - Unit Testing Principles Practices and Patterns
.
Learned a lot of unit test and integration best practice and code design.
So I want to share some knowledge with you.
Test
There are two kinds of tests.
- Unit Test
- Integration Test
- end to end test
Test Coverage
Do we need a 100% test coverage?
No. We don’t.
For trivial code, we can ignore that. Because they aren’t worth it.
We should focus on our business logic.
If a metric shows that there’s too little coverage in your code base—say