You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by 王喜春 <sl...@qq.com> on 2019/09/26 21:40:16 UTC

config rules to exclude some unnecessary code for unit code coverage?

Hi,   for example, the code shown in the following pic, method of getDataSources return "backendDataSource.getDataSourceParameters()" directly. 

the full url is : https://coveralls.io/builds/25937232/source?filename=sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java




it seems that there is little necessary for some code. 


So I'd like to know, is there some standard for unit code coverage rate? if so, has this coverage rate been configured into some file?




Tks.

回复:config rules to exclude some unnecessary code for unit codecoverage?

Posted by 王喜春 <sl...@qq.com>.
Ok, Tks, I get it. 




------------------ 原始邮件 ------------------
发件人: "Sion Yang"<sc...@163.com>;
发送时间: 2019年9月27日(星期五) 上午9:55
收件人: "dev"<de...@shardingsphere.apache.org>;

主题: Re:回复:config rules to exclude some unnecessary code for unit codecoverage?



Hi, sluk3r.


For single method such as set/get method, we use Lombok to generate. These code can miss unit test.
But other methods should be full covered, if no particular reasons.


For the method you print out. I think it should have a unit test, even use Mockito backendDataSource.


In community document[1], you can see the `Covenant Unit Test of Conduct`


[1] https://shardingsphere.apache.org/community/en/contribute/code-conduct/


--

Yi Yang(Sion)
Apache ShardingSphere



在 2019-09-27 09:25:49,"王喜春" <sl...@qq.com> 写道:
>Hi, Sion Yang: 
>
>
>the method's whole implementation is:
>
>
>public Map<String, YamlDataSourceParameter> getDataSources() {
>    return backendDataSource.getDataSourceParameters();
>}
>there is just a single return statement, intuitively, I think there is little necessary to unit test this method. Or this type of problem has been discussed, and agreement has been achieved?  give me a point, pls.
>Tks
>
>
>
>
>------------------ 原始邮件 ------------------
>发件人: "Sion Yang"<sc...@163.com>;
>发送时间: 2019年9月27日(星期五) 上午8:51
>收件人: "dev"<de...@shardingsphere.apache.org>;
>
>主题: Re:config rules to exclude some unnecessary code for unit codecoverage?
>
>
>
>Hi, sluk3r.
>
>
>How to judge these codes are unnecessary or little necessary?
>
>
>
>
>--
>
>Yi Yang(Sion)
>Apache ShardingSphere
>
>
>At 2019-09-27 05:40:16, "王喜春" <sl...@qq.com> wrote:
>
>Hi,   for example, the code shown in the following pic, method of getDataSources return "backendDataSource.getDataSourceParameters()" directly. 
>the full url is : https://coveralls.io/builds/25937232/source?filename=sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java
>
>
>
>
>it seems that there is little necessary for some code. 
>
>
>So I'd like to know, is there some standard for unit code coverage rate? if so, has this coverage rate been configured into some file?
>
>
>
>
>Tks.

Re:回复:config rules to exclude some unnecessary code for unit codecoverage?

Posted by Sion Yang <sc...@163.com>.
Hi, sluk3r.


For single method such as set/get method, we use Lombok to generate. These code can miss unit test.
But other methods should be full covered, if no particular reasons.


For the method you print out. I think it should have a unit test, even use Mockito backendDataSource.


In community document[1], you can see the `Covenant Unit Test of Conduct`


[1] https://shardingsphere.apache.org/community/en/contribute/code-conduct/


--

Yi Yang(Sion)
Apache ShardingSphere



在 2019-09-27 09:25:49,"王喜春" <sl...@qq.com> 写道:
>Hi, Sion Yang: 
>
>
>the method's whole implementation is:
>
>
>public Map<String, YamlDataSourceParameter> getDataSources() {
>    return backendDataSource.getDataSourceParameters();
>}
>there is just a single return statement, intuitively, I think there is little necessary to unit test this method. Or this type of problem has been discussed, and agreement has been achieved?  give me a point, pls.
>Tks
>
>
>
>
>------------------ 原始邮件 ------------------
>发件人: "Sion Yang"<sc...@163.com>;
>发送时间: 2019年9月27日(星期五) 上午8:51
>收件人: "dev"<de...@shardingsphere.apache.org>;
>
>主题: Re:config rules to exclude some unnecessary code for unit codecoverage?
>
>
>
>Hi, sluk3r.
>
>
>How to judge these codes are unnecessary or little necessary?
>
>
>
>
>--
>
>Yi Yang(Sion)
>Apache ShardingSphere
>
>
>At 2019-09-27 05:40:16, "王喜春" <sl...@qq.com> wrote:
>
>Hi,   for example, the code shown in the following pic, method of getDataSources return "backendDataSource.getDataSourceParameters()" directly. 
>the full url is : https://coveralls.io/builds/25937232/source?filename=sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java
>
>
>
>
>it seems that there is little necessary for some code. 
>
>
>So I'd like to know, is there some standard for unit code coverage rate? if so, has this coverage rate been configured into some file?
>
>
>
>
>Tks.

回复:config rules to exclude some unnecessary code for unit codecoverage?

Posted by 王喜春 <sl...@qq.com>.
Hi, Sion Yang: 


the method's whole implementation is:


public Map<String, YamlDataSourceParameter> getDataSources() {
    return backendDataSource.getDataSourceParameters();
}
there is just a single return statement, intuitively, I think there is little necessary to unit test this method. Or this type of problem has been discussed, and agreement has been achieved?  give me a point, pls.
Tks




------------------ 原始邮件 ------------------
发件人: "Sion Yang"<sc...@163.com>;
发送时间: 2019年9月27日(星期五) 上午8:51
收件人: "dev"<de...@shardingsphere.apache.org>;

主题: Re:config rules to exclude some unnecessary code for unit codecoverage?



Hi, sluk3r.


How to judge these codes are unnecessary or little necessary?




--

Yi Yang(Sion)
Apache ShardingSphere


At 2019-09-27 05:40:16, "王喜春" <sl...@qq.com> wrote:

Hi,   for example, the code shown in the following pic, method of getDataSources return "backendDataSource.getDataSourceParameters()" directly. 
the full url is : https://coveralls.io/builds/25937232/source?filename=sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java




it seems that there is little necessary for some code. 


So I'd like to know, is there some standard for unit code coverage rate? if so, has this coverage rate been configured into some file?




Tks.

Re:config rules to exclude some unnecessary code for unit code coverage?

Posted by Sion Yang <sc...@163.com>.
Hi, sluk3r.


How to judge these codes are unnecessary or little necessary?




--

Yi Yang(Sion)
Apache ShardingSphere


At 2019-09-27 05:40:16, "王喜春" <sl...@qq.com> wrote:

Hi,   for example, the code shown in the following pic, method of getDataSources return "backendDataSource.getDataSourceParameters()" directly. 
the full url is : https://coveralls.io/builds/25937232/source?filename=sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java




it seems that there is little necessary for some code. 


So I'd like to know, is there some standard for unit code coverage rate? if so, has this coverage rate been configured into some file?




Tks.