I think you have misunderstood what I mean. I personally think that zk plays a 
very important role in our project, so I think that zk must be reflected in the 
unit test. Currently we use the stand-alone version of zk, which will increase 
us The complexity and instability of the test, so a better approach is to use 
mock zk. As for whether a real environment needs to be used in e2e, I 
personally think it is a bit redundant. After all, the simulated client has 
already done this part of the work.
————————
我想您误解了我的意思,我认为,zk在我们的项目中承担了相当重要的角色,所以保证这块的正确性非常重要,ut本身应该保证它的一个简单性,可测性。这点我很同意@yangyichao同学的观点,我们应该在ut环节确保它的正确性,而不是在e2e环节,Apache
 
Curator本身提供了zk的模拟客户端,这会简化我们的测试流程与复杂度,同时保证了ut的可测性、稳定性。我们完全可以在ut环节完成逻辑正确性的校验。您觉得呢?
Best  wishes!
CalvinKirs


On 08/5/2020 10:41,wu shaoj<[email protected]> wrote:
I don't think so. We should use UT to guarantee the whole logic, if all the UT 
test passed, then most logic should be correct.
The purpose of UT is not only to cover a function for simple test, which is not 
enough.

---------------
我觉得UT就是用来做测试的、用来保证编写的逻辑是否正确的,不能单纯为了开发简单点,就简化UT。
其实测试分为单元测试、集成测试等几个步骤。单元测试可以尽量简化,保证基本逻辑正确,在此基础上增加集成测试,尽量测试各种场景。



On 2020/7/31, 22:36, "CalvinKirs" <[email protected]> wrote:

I agree with you, but some aspects need to be discussed. We should not put the 
test logic of zk and database in the e2e test. This is a bit cumbersome and 
does not meet the unit test specification. Regarding the unit test of the 
server module, I will come up with a plan and complete it later.


Best  wishes!
CalvinKirs


On 07/31/2020 21:07,Yichao Yang<[email protected]> wrote:
Hi all,


The purpose of this discussion is to discuss the UT specification of DS.


My thoughts are as follows:


1. About DS ut test (maybe include database)


Using framework: mockito, powermockito
Reason: The purpose of UT is to cover a function for simple test. We can not or 
do not need to just place all the test verification process on ut. Therefore, 
it is necessary to restore the essence of UT and simplify the difficulty of 
writing UT.
For example: If UT is used to test the whole process of an API, there will be a 
lot of conditions to be considered. It will be difficult to consider each 
condition. However, if we only direct each ut to the corresponding method and 
cover this method as completely as possible, the error rate of functional 
testing will be greatly reduced.


2. About ZK, front end test, (may be include database)


Module: put this part of the test in the E2E module


Reason: because these components are end-to-end originally, which is conducive 
to module division.



-------------------


各位社区同学们,大家好:


这次讨论的目的:讨论关于ds的ut编写规范。


我的想法如下:
1.关于ds ut测试(可以包含数据库):
使用框架:Mockito,PowerMockito
目的:还原ut的本质,简化ut,但依然发挥ut的最大作用,并且降低ut编写的难度。
原因:ut的目的就是为了简单的测试覆盖一个函数,我们不可能也不需要把所有的测试验证过程都寄托于ut。所以还原ut的本质,简化ut编写难度是一个相对较好的选择。
举个例子:如果ut用来测试一个api的整个流程,其中需要考虑的条件判断会非常多,去吧每一种条件都考虑到会比较难。但是如果我们将每个ut只正对对应的方法上,并将这个方法覆盖尽可能完全,那么功能性测试的错误率会大大降低。


2.关于zk,前端测试,(可以包含数据库)
模块:将这部分的测试放在e2e模块
原因:因为这些都是数据端对端的测试,利于模块划分。


If you have any opinions or suggestions, welcome to put forward.


Best,
Yichao Yang

Reply via email to