apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code
https://dolphinscheduler.apache.org/
Apache License 2.0
12.9k stars 4.63k forks source link

[DSIP-10][Unit Tests] Improve DolphinScheduler unit tests #10573

Open EricGao888 opened 2 years ago

EricGao888 commented 2 years ago

Search before asking

Description

Unit Tests of high quality could not only improve the stability of Dolphin Scheduler, but also increase the readability of Dolphin Scheduler Code.

Use case

Related issues

Action Items

Refactoring Guideline

Progress

Module Sub-Module Class issue status
dolphinscheduler-api
dolphinscheduler-master
dolphinscheduler-worker
dolphinscheduler-common
dolphinscheduler-service
dolphinscheduler-alert dolphinscheduler-alert-server AlertServer
dolphinscheduler-task-plugin

Appendix: UT coverage of each module before refactoring

image image image image

Are you willing to submit a PR?

Code of Conduct

github-actions[bot] commented 2 years ago

Thank you for your feedback, we have received your issue, Please wait patiently for a reply.

SbloodyS commented 2 years ago

That's great!

EricGao888 commented 2 years ago

That's great!

@SbloodyS Thx. Hope this will help and attract more new developers to submit PRs for DS and offer them an approach to get familiar with the code smoothly.

davidzollo commented 2 years ago

great

EricGao888 commented 2 years ago

IMHO, we need some priorities, we could apply high priority to those modules where UT might play a more significant role regarding to code quality and application stability.

EricGao888 commented 2 years ago

@SbloodyS Could you please help add a discussion label to this issue? Much appreciated~

SbloodyS commented 2 years ago

IMHO, we need some priorities, we could apply high priority to those modules where UT might play a more significant role regarding to code quality and application stability.

We can make a list and mark it with priority.

EricGao888 commented 2 years ago

I got blocked by some unit test when developing a new feature and mocking some unusual stuff for nearly a day. I would like to update the UT docs with some examples which may help new developers bypass or overcome some pitfalls in UTs. May I ask whether it is possible to migrate this docs into main repo? @zhongjiajie https://dolphinscheduler.apache.org/en-us/community/development/unit-test.html

Thanks

zhongjiajie commented 2 years ago

I got blocked by some unit test when developing a new feature and mocking some unusual stuff for nearly a day. I would like to update the UT docs with some examples which may help new developers bypass or overcome some pitfalls in UTs. May I ask whether it is possible to migrate this docs into main repo? @zhongjiajie https://dolphinscheduler.apache.org/en-us/community/development/unit-test.html

Thanks

Of cause, we can, do you interesting in this migration?

EricGao888 commented 2 years ago

I got blocked by some unit test when developing a new feature and mocking some unusual stuff for nearly a day. I would like to update the UT docs with some examples which may help new developers bypass or overcome some pitfalls in UTs. May I ask whether it is possible to migrate this docs into main repo? @zhongjiajie https://dolphinscheduler.apache.org/en-us/community/development/unit-test.html Thanks

Of cause, we can, do you interesting in this migration?

Yes, I'd love to give a shot.

EricGao888 commented 2 years ago

BTW, we could fix the formatting and style errors incrementally, together with unit tests. See: #10963 One convenient way is when refactoring some UTs, we fix the formatting and style errors of both the testing and tested part.

EricGao888 commented 2 years ago

I've generated test coverage reports for every module of DS using Intellij, sorted by method coverage. Here are some results: image image image image

EricGao888 commented 2 years ago

I will update this issue with a more detailed refactoring plan as well as priorities later this week.

stalary commented 2 years ago

I can get involved in the junit upgrade~ @EricGao888

EricGao888 commented 2 years ago

I can get involved in the junit upgrade~ @EricGao888

@stalary Currently we are working on removing powermock because it does not support jUnit 5 and blocks the upgrade. Would u like to participate in #11405 ? Thanks~

stalary commented 2 years ago

Currently we are working on removing powermock because it does not support jUnit 5 and blocks the upgrade. Would u like to participate in

Okay, I can be a part of that.

EricGao888 commented 2 years ago

Currently we are working on removing powermock because it does not support jUnit 5 and blocks the upgrade. Would u like to participate in

Okay, I can be a part of that.

@stalary Great! We have #12150 open to contributors. Would u like to pick it up? Thanks

stalary commented 2 years ago

Currently we are working on removing powermock because it does not support jUnit 5 and blocks the upgrade. Would u like to participate in

Okay, I can be a part of that.

@stalary Great! We have #12150 open to contributors. Would u like to pick it up? Thanks

Please assign to me, thanks~

EricGao888 commented 2 years ago

Usage of Powermock has been fully removed from the whole project : )

zhongjiajie commented 2 years ago

Usage of Powermock has been fully removed from the whole project :

Great new