suneet-s commented on a change in pull request #9995: URL: https://github.com/apache/druid/pull/9995#discussion_r436797510
########## 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. Review comment: I think we should call out that our current code coverage checks are merely smoke tests. They only verify that a line/ branch of code has been called during the test, but not that the functionality has been tested sufficiently. Reviewers should still verify that all the different branches are sufficiently tested by reviewing the tests. ########## File path: dev/intellij-setup.md ########## @@ -34,6 +34,14 @@ an alias name. You can do this in Using `File` -> `Project Structure...` -> `Pla ## Code Style The Code Style is available in XML format at [druid_intellij_formatting.xml](druid_intellij_formatting.xml) and can be [imported into IntelliJ](https://www.jetbrains.com/help/idea/2017.1/copying-code-style-settings.html). +## Set Code Coverage Runner +Druid CI checks are configured to enforce code coverage using JaCoCo. The checks will prevent PR from being merged +if test coverage of new added code is below the set threshold. You should run the tests locally to make sure that +your code pass the coverage threshold. In IntelliJ, edit the template of JUnit tests in "Run Configurations..." +to use Jacoco for code coverage (this provides branch coverage instead of the default which is only line coverage). +You can then right click src/test/java folder of the modules you are modifying and click run with coverage. This +will generate a report to show the current code coverage on the code (not just your change). + Review comment: Can you add screenshots to this section to make it easier for devs to follow along ---------------------------------------------------------------- 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]
