maytasm commented on a change in pull request #9995: URL: https://github.com/apache/druid/pull/9995#discussion_r438498150
########## File path: dev/code-review/code-coverage.md ########## @@ -0,0 +1,33 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +# Druid's Code Coverage Enforcement + +Druid has an automated way of checking if new code has adequate unit tests. +Druid CI checks are configured to enforce code coverage using JaCoCo. The CI checks will prevent PR from being merged +if test coverage of new added code is below the set threshold. The CI checks filters test coverage based on a diff from +your PR and make sure that the thresholds are met. Druid currently enforce branch and line code coverage. + +## Running code coverage locally +Code coverage should be run locally to make sure the PR will pass Druid CI checks. +1. Code coverage on the codebase can be generated directly in [Intellij](../intellij-setup.md#Set-Code-Coverage-Runner). +2. Code coverage on just the diff of your PR can be generated in your terminal. First, you will have to install +diff-test-coverage by running `npm install @connectis/diff-test-coverage`. Next, run the unit tests +for the module you are working on `mvn -pl <MODULE_TO_CHECK> test jacoco:report`. Finally, run Review comment: 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: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
