Repository navigation
Codecov: Getting Started
Yarden Lev edited this page Apr 4, 2017
·
1 revision
This page is based on SmartCity-Market's wiki page regarding Codecov, with some modifications.
Codecov allows us to:
- Measure the code coverage of our project
- Have a nice Dashboard that provides detailed statistics
- Ignore folders and / or files we do not want to include while computing the code coverage of our project.
Note: You can use Codecov in all of your public repositories and one private repository, for free.
This steps describes how to start working with Codecov in a Maven Java project:
- Sign in Codecov with your GitHub account.
- Select the repository you want to apply Codecov for. (Projects under TechnionYP5777 were already granted access)
- Add the following to your
pom.xmlfile:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check />
</configuration>
</plugin>- Add the following to your
.travis.ymlfile:
# safe list: add here branches you want to verify the build & tests will pass
branches:
only:
- master
# add this if you use maven for your project and want to verify mvn build is successful and all unit tests pass.
script:
- mvn test
- mvn cobertura:cobertura
# running coverage tool
after_success:
- bash <(curl -s https://codecov.io/bash)- Add a
codecov.ymlfile.
- This file contains configurations of the Codecov's coverage process.
- It has many optional sections, we will focus on the ignore section.
- For more information and options, click here.
- For a specific examples, this is our file and this is SmartCity-Market's file.
- The ignore section allows us to exclude files from the code coverage computations.
- Its location is under the coverage section.
- It is excellent for excluding GUI files that usually are not tested using unit tests and thus decreasing overall coverage.
- In order to exclude a file, add its path under the ignore section, surrounded by quotations marks. For example:
"src/main/java/il/ac/technion/cs/smarthouse/applications/PremadeApplications.java" - In order to exclude a whole folder, add its path with a
/*at the end under the ignore section, surrounded by quotations marks. For example:"src/main/java/il/ac/technion/cs/smarthouse/applications/*"
- Commit and push your changes. Travis checks should pass and you should be able to see your project's code coverage and statistics in your project's Dashboard.
- This is our Dashboard.
You can add badges to your project's README.md file.
- Badges provides information about your project and being updated dynamically (you can click them for more details).
- You can see our badges in our README file (your project's badges will be similar).
- For coverage badge we added:
[](https://codecov.io/gh/TechnionYP5777/Smartcity-Smarthouse)- For build badge we added:
[](https://travis-ci.org/TechnionYP5777/Smartcity-Smarthouse)
Overview
Quick Start
Smarthouse Usage for Owners
Development Manuals
Continuous Development
Misc.