You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/08/05 11:45:27 UTC

[GitHub] [incubator-dolphinscheduler-website] CalvinKirs opened a new pull request #165: [docs] unit test benchmark specification

CalvinKirs opened a new pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165


   unit test benchmark specification


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on a change in pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467357773



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则

Review comment:
       Hi,
   Please improve the doc according to the specifications[1].
   <Strong>*1.Chinese punctuation mark*</Strong>
   <Strong>*2.The blank in Chinese and English*</Strong>
   
   [1] https://dolphinscheduler.apache.org/zh-cn/docs/development/document.html
   ![image](https://user-images.githubusercontent.com/29545877/89701920-2a728680-d96e-11ea-857d-aa65461ac141.png)
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] gabrywu commented on pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
gabrywu commented on pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#issuecomment-670342129


   @CalvinKirs Let's invite @dailidong and @qiaozhanwei to review this PR, if there're no opposite suggestions, this can be merged


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on a change in pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467357541



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则
+### 1: 隔离性与单一性
+
+一个测试用例应该精确到方法级别,并应该能够单独执行该测试用例。同时关注点也始终在该方法上(只测试该方法)。
+
+如果方法过于复杂,开发阶段就应该将其再次进行拆分,对于测试用例来讲,最佳做法是一个用例只关注一个分支(判断)。当对其进行修改后,也仅仅影响一个测试用例的成功与否。这会极大方便我们在开发阶段验证问题和解决问题,但与此同时,也对我们覆盖率提出了极大的挑战。
+
+### 2:自动性
+
+单元测试能够自动化进行。强制要求:所有的单元测试必须写在src/test下,同时方法命名应该符合规范。基准测试除外。
+
+### 3:可重复性
+
+多次执行(任何环境任何时间)结果唯一,且可以重复执行。
+
+
+### 4:轻量型
+
+即任何环境都可快速执行。
+
+这要求我们尽可能不要依赖太多组件,如各种spring bean之类的。在单元测试中,这些都是可被mock的,增加这些,会加大我们单测的执行速度,同时也可能会传递污染。
+
+对于一些数据库、其他外部组件等。尽可能也采用模拟客户端的形式,即不依赖于外部环境,(任何外部依赖的存在都会极大的限制测试用例的可迁移性和稳定性以及结果正确性),这同时也方便开发者在任何环境都能够进行测试。
+
+
+

Review comment:
       ```suggestion
   
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] CalvinKirs commented on a change in pull request #165: [Improvement][docs] Unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467368010



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则

Review comment:
       Thx.done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on a change in pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467357773



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则

Review comment:
       Hi,
   Please improve the doc according to the specifications[1].
   *1.Chinese punctuation mark*
   *2.The blank in Chinese and English*
   
   [1] https://dolphinscheduler.apache.org/zh-cn/docs/development/document.html
   ![image](https://user-images.githubusercontent.com/29545877/89701920-2a728680-d96e-11ea-857d-aa65461ac141.png)
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] dailidong merged pull request #165: [Improvement][docs] Unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
dailidong merged pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on a change in pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467357773



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则

Review comment:
       Hi,
   Please improve the doc according to the specifications[1].
   
   [1] https://dolphinscheduler.apache.org/zh-cn/docs/development/document.html
   ![image](https://user-images.githubusercontent.com/29545877/89701920-2a728680-d96e-11ea-857d-aa65461ac141.png)
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#issuecomment-670819914


   Please change the title to `[Improvement][docs] Unit test benchmark specification`. Thx a lot~.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on a change in pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467357659



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则
+### 1: 隔离性与单一性
+
+一个测试用例应该精确到方法级别,并应该能够单独执行该测试用例。同时关注点也始终在该方法上(只测试该方法)。
+
+如果方法过于复杂,开发阶段就应该将其再次进行拆分,对于测试用例来讲,最佳做法是一个用例只关注一个分支(判断)。当对其进行修改后,也仅仅影响一个测试用例的成功与否。这会极大方便我们在开发阶段验证问题和解决问题,但与此同时,也对我们覆盖率提出了极大的挑战。
+
+### 2:自动性
+
+单元测试能够自动化进行。强制要求:所有的单元测试必须写在src/test下,同时方法命名应该符合规范。基准测试除外。
+
+### 3:可重复性
+
+多次执行(任何环境任何时间)结果唯一,且可以重复执行。
+
+
+### 4:轻量型
+
+即任何环境都可快速执行。
+
+这要求我们尽可能不要依赖太多组件,如各种spring bean之类的。在单元测试中,这些都是可被mock的,增加这些,会加大我们单测的执行速度,同时也可能会传递污染。

Review comment:
       ```suggestion
   这要求我们尽可能不要依赖太多组件,如各种 spring bean 之类的。在单元测试中,这些都是可被 mock 的,增加这些,会加大我们单测的执行速度,同时也可能会传递污染。
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] yangyichao-mango commented on a change in pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
yangyichao-mango commented on a change in pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#discussion_r467357596



##########
File path: docs/zh-cn/development/unit-test.md
##########
@@ -15,3 +15,94 @@ Unit Test编写参考[链接](https://github.com/apache/incubator-dolphinschedul
   * 在现阶段,Delta更改代码的测试覆盖设定值为:>=60%,越高越好。
   * 我们可以在这个页面中看到测试报告: https://codecov.io/gh/apache/dolphinscheduler
 
+## 单元测试基本准则
+### 1: 隔离性与单一性
+
+一个测试用例应该精确到方法级别,并应该能够单独执行该测试用例。同时关注点也始终在该方法上(只测试该方法)。
+
+如果方法过于复杂,开发阶段就应该将其再次进行拆分,对于测试用例来讲,最佳做法是一个用例只关注一个分支(判断)。当对其进行修改后,也仅仅影响一个测试用例的成功与否。这会极大方便我们在开发阶段验证问题和解决问题,但与此同时,也对我们覆盖率提出了极大的挑战。
+
+### 2:自动性
+
+单元测试能够自动化进行。强制要求:所有的单元测试必须写在src/test下,同时方法命名应该符合规范。基准测试除外。
+
+### 3:可重复性
+
+多次执行(任何环境任何时间)结果唯一,且可以重复执行。
+
+

Review comment:
       ```suggestion
   
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler-website] CalvinKirs commented on pull request #165: [docs] unit test benchmark specification

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on pull request #165:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/165#issuecomment-670484398


   > @CalvinKirs Let's invite @dailidong and @qiaozhanwei to review this PR, if there're no opposite suggestions, this can be merged
   
   Thank you very much for your review


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org