Test Coverage Guide
Test Coverage Guide
Benefits of Writing Unit Tests
- Unit tests help everyone dive into the details of the code and understand its functionality.
- Through test cases, we can discover bugs and enhance the robustness of the code.
- Test cases also serve as demo usage of the code.
Some Design Principles for Unit Test Cases
- Steps, granularity, and combination conditions should be carefully designed.
- Pay attention to boundary conditions.
- Unit tests should also be well-designed; do not write useless code.
- When you find a
method
difficult to unit test, if it can be confirmed that this method
is smelly code
, then refactor it together with the developer. - The mock framework used in Dubbo is: mockito. Below are some developer guides: mockito tutorial, mockito refcard
- TDD (optional): When you start writing a new feature, you can try to write the test cases first.
Test Coverage Threshold