Test Coverage Guide
The benefits of unit testing
- Unit test code can help everyone to go into details and understand the function of the code.
- We can find bugs by test case, and then enhance the robustness of the code.
- Test case code is also the demo usage of the core code.
Some design principle of unit test case
- Steps, fine-grained and combination conditions should be well designed.
- Attention to boundary condition test
- Test code should also be designed without writing useless code.
- When you find a
methodthat is hard to write unit test, if you can be sure themethodis “smelly code”, then refactor it with the committer. - The mock framework in dubbo is: mockito. Some tutorials:mockito tutorial,mockito refcard
- TDD(optional):When you start a new issue, you can try to write test case at first
The specified value of the test coverage
- In the stage, the test coverage specified value of delta changed codes is :>=60%. The higher, the better.
- We can see the coverage report in this page: https://codecov.io/gh/apache/dubbo
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified January 22, 2021: Merge branch 'master' of https://github.com/apache/dubbo-website (f48eac9)
