Skip to content

Test coverage guide

Xin Wang edited this page Apr 25, 2018 · 8 revisions

1.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.

2.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 method that is hard to write unit test, if you can be sure the method is "smelly code", then refactor it with the committer.
  • The mock framework in dubbo is: jmockit.
  • TDD(optional):When you start a new issue, you can try to write test case at first

3.The specified value of the test coverage