📖
Typo Help Docs
  • Welcome
  • Getting Started
    • Onboarding
    • Integrations
      • Git
        • GitHub
        • GitLab
        • BitBucket
        • Azure Repos
        • Gitlab On-prem
      • Issue Tracker
        • JIRA
        • Linear
        • GitHub Issue
        • Shortcut
        • ClickUp
      • CI/CD Tool
        • Circle CI
        • Jenkins
        • Heroku
        • GitHub Actions
        • Azure DevOps
        • Custom Deployment Webhook
      • Slack
    • How Requestly setup Typo in a few days
  • Platform
    • Dev Analytics
      • DORA
      • Insights
        • Teams
        • Members
        • Sprints
        • Pull Requests
        • Deployments
      • Incident
      • Goals
      • Investment
      • Initiative
      • WorkLog
      • Custom Reports
      • Settings
        • Teams
        • Member
        • Repository
        • Projects
        • Manage Access
        • Notifications
    • Code Health
      • Code Review
      • Code Coverage
    • DevEx
  • Implementation Plan
    • Phase 1 - Setting Up Data Sources
    • Phase 2 - Metric Configuration
      • Dev360
      • Code Health
      • DevEx
    • Phase 3 - Team Rollout
  • Engineering Metrics
    • DORA
      • Cycle Time
      • Deployment PRs
      • Change Failure Rate
      • Mean Time to Restore
    • Pull Request Metrics
      • Avg. Commits During PR Review
      • Coding Days
      • Coding Time
      • Merge frequency
      • Merge Time
      • Pickup Time
      • PR Size
      • PRs Merged without Review
      • Review Time
      • Efficiency Score
    • Sprint Metrics
      • Carry over
      • Developer Workload
      • Issue Cycle Time
      • Issues At-Risk
      • Scope creep
      • Team Velocity
      • Work Breakup
      • Work Progress
    • Code Quality Metrics
      • OWASP Top 10
      • Vulnerability
      • Security
      • Performance
      • Duplication
      • Code Smell
    • Deployment Metrics
      • Deployment - Failure
      • Deployment - Frequency
      • Time to Build
    • Incident Metrics
      • Incident - Opened
      • Avg Resolution Time
    • DevEx Metrics
      • DevEx Score
      • Space mood
      • Response Rate
      • Manager Support
      • Developer Flow
      • Product Management
      • Development & Releases
      • Culture & Values
  • Configurations
    • Cycle Time
    • Deployment PRs
    • Change Failure Rate (CFR)
    • Mean Time To Restore (MTTR)
    • CI/CD - Deployment
    • Incident
    • Initiative
    • Investment Distribution
    • PR Labels
    • Code Health
    • Code Coverage
    • DevEx
    • Notifications
    • Manage Access
  • FAQ's
    • Data Security
      • GitHub App Permissions Details
      • Why does Typo need write permission to my code?
      • Does Typo has access to my code?
      • What data security guidelines does Typo follow?
    • Integrations
      • Can Typo application work with on-prem Gitlab?
      • How do I get Issue Tracker data?
      • How do I get Git data?
    • Pricing
      • How does the pricing work?
      • How do I upgrade my plan?
    • Access Management
      • My team member is not able to login to Typo
    • Metrics
      • How does Typo predict developer burnout?
      • Is there a way to change the branch that Deployment PRs are measured against?
      • Synchronize “CFR” & “MTTR” without incident management?
      • How quick does the pull-request page update? I closed a PR but the Typo still shows Awaiting Review
      • How do I add any new repo?
      • How to Configure Typo Code Health Checks to Block a PR Merge in Git
      • Can I exclude a person from metrics calculation?
      • Can I track the Cycle time based on the status of the JIRA tickets?
      • How do I unlink the JIRA tracker & integrate Linear?
      • How to exclude a PR from any metric calculation?
      • My data is not visible, I have synced the repo
    • Platform
      • Can I use your application on-premise?
    • Delete Account
      • How can I delete my account?
Powered by GitBook
On this page
  • 1. Creating Coverage Reports
  • 2. Uploading coverage data to Typo
  1. Configurations

Code Coverage

PreviousCode HealthNextDevEx

Last updated 3 months ago

To set up code coverage, you need to activate the code health feature on your account. Once done, follow the below-mentioned steps to get started with code coverage-

Navigate to the to get your account token details.

We evaluate the overall repository coverage in Code Coverage to provide better insights into PR coverage. Since we show the change in coverage caused by a PR, we need the repository's baseline coverage value. The repository coverage should also be updated whenever there’s a change in the master/default branch. You can set this up as part of your deployment to trigger the coverage run whenever something is pushed or merged into the master/default branch.

1. Creating Coverage Reports

Before you can use Typo to show code coverage metrics for your project, you need to run tests and use tools to generate reports that show how much of your code is covered by tests. Consider these points when generating coverage reports:

  • There are various tools available for generating coverage reports, but you need to make sure that the reports are in a format that Typo can understand.

  • Ensure that your coverage reports include data for all the code files that were tested, not just the ones that were changed in each commit.

  • Below is a table of example coverage tools that produce reports in formats supported by Typo:

2. Uploading coverage data to Typo

Once you've configured coverage reports, you must utilize the Typo Coverage Script to upload them to Typo. The best practice for this task is to employ a CI/CD platform that automatically executes tests, generates coverage reports, and then employs the Typo Coverage Script to upload the coverage information to Typo.

Step 1

Add Typo Access Token to your environment variable as TYPO_ACCESS_TOKEN

export TYPO_ACCESS_TOKEN=a0ac0e20-62d9-xxxx

Step 2

Add Typo Client ID to your environment variable as TYPO_CLIENT_ID

export TYPO_CLIENT_ID={b21ed0a2-xxxx}

Step 3 (optional)

To specify the branch for the coverage report as an environment variable

Github Actions - env: GITHUB_HEAD_REF: ${{ github.head_ref }} Jenkins - export GITHUB_HEAD_REF=$(git rev-parse --abbrev-ref HEAD) echo "GITHUB_HEAD_REF=${GITHUB_HEAD_REF}" Circle CI - jobs: build: docker: - image: circleci/python:3.8 steps: - checkout - run: name: Set GITHUB_HEAD_REF command: | echo "export GITHUB_HEAD_REF=${CIRCLE_BRANCH}" >> $BASH_ENV - run: name: Print GITHUB_HEAD_REF command: | source $BASH_ENV echo "GITHUB_HEAD_REF is $GITHUB_HEAD_REF" # Add more steps as needed

Step 4

To ensure that your code coverage metrics are collected and reported accurately, you need to add the coverage step to your build process. This step involves running the following bash command after your tests have been executed, during your build process to upload the coverage report:

bash <(curl -Ls https://typo-website-static.s3.ap-south-1.amazonaws.com/typo-coverage.sh) REPORT_PATH --head=$GITHUB_HEAD_REF

REPORT_PATH: This should be replaced with the actual path to your coverage report file.

GITHUB_HEAD_REF: This field is optional. Consider STEP 3 to get the branch name.

You need to execute this command at two specific points in your development workflow:

  • During Production Builds: This ensures that coverage data is collected for the code being deployed to production.

  • During Pull Request (PR) Creation or Modification: This helps to track and verify coverage for changes introduced by the PR.

code coverage section