dubbo Unit test cases Improvement Project

7gcisfzg  于 2023-02-04  发布在  其他
关注(0)|答案(5)|浏览(485)

Background

Unit test case completion refers to the completion and supplement of unit test cases in the main warehouse to improve Dubbo's unit test code coverage.

At present, priority is given to improving the code unit test coverage of the 3.0 branch.

Dubbo's unit test uses Junit5 + Mockito (Dubbo Spring Boot uses Junit4 to be compatible with Springboot 1.x) test framework.

For special scenarios that need to introduce other dependencies, you can refer to existing repositories or ask us questions.

Unit testing needs to achieve full coverage of core processes as much as possible, and test cases have good reentrancy.
Considering that the repo is large and there are many contributors, multiple people and multiple use cases can test a certain piece of code together in order to improve code coverage and boundary condition coverage.

The unit test report can be seen at https://app.codecov.io/gh/apache/dubbo/branch/3.0 , and please focusing on improving the code coverage of the main process.

How To

  • Submit your PR which contains the test cases directly to apache/dubbo.
  • Leave a comment under this Issue so that we can track this project. You can just simply comment like @AlbumenJ have submit a PR #xxxx(replaced with the PR number) about NacosRegistry(replaced with the related module) to improve test coverage .

For Newcomer

Notice

  • For those who need to start the Netty, complete Dubbo protocol, it is necessary to ensure that the environment is cleaned up after the test case is over
  • For those that need to rely on ApplicationModel , they need to be reset each time they are used up
  • For those using the Spring environment, you must close or use DirtiedContext after each startup
  • For other environments, please consider the environmental pollution caused by unit testing, especially the pollution of static variables
wydwbb8l

wydwbb8l1#

@AlbumenJ can i work on this issue.

rqenqsqc

rqenqsqc2#

It is recommended to use mock as much as possible for UT to reduce the behavior of introducing server-side core components and starting the service for testing.
Doing so will help increase the speed of unit test execution.

eufgjt7s

eufgjt7s3#

iqjalb3h

iqjalb3h4#

@AlbumenJ I have add an unit test last week. Can I work more on adding unit tests? Or are there any recommened files of this issues that need to deal with?

zrfyljdw

zrfyljdw5#

@hadley0828 It welcome to submit multi PRs. Also, please try patch them to 3.0 branch, which is more significant for us recently.
are there any recommened files of this issues that need to deal with?

We are using codecov to trach line coverage. You can mention at https://app.codecov.io/gh/apache/dubbo/branch/3.0 .
The easy way to find out which files are needed to deal with is find out commit in the latest 3.0 branch and follow the way in the below screen shot.

相关问题