Documentation Index
Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Upload test coverage reports to CodeAnt AI for comprehensive analysis, visualization, and tracking of your code coverage metrics. Reference Repository: codeant-coverageFeatures
- 📊 Upload coverage reports in XML format (Cobertura XML, JaCoCo XML)
- 🔍 Automatic coverage analysis and insights
- 📈 Track coverage trends over time
- 🎯 Integration with pull requests
- 🚀 Easy setup with minimal configuration
- 🏢 Support for self-hosted/enterprise instances
Setup
1. Get Your Access Token
Bitbucket supports two token scopes — use whichever fits your setup:| Token Type | Best For | Where to Create |
|---|---|---|
| Repository Access Token | Single repository | Repository Settings → Security → Access tokens |
| Workspace Access Token | All repos in a workspace | Workspace Settings → Security → Access tokens |
- Go to your repository Settings
- Navigate to Security > Access tokens
- Click Create repository access token
- Select permissions:
- Repositories: Read, Write
- Pull requests: Read, Write
- Copy the generated token
- Go to your workspace Settings
- Navigate to Security > Access tokens
- Click Create workspace access token
- Select the same permissions as above
- Copy the generated token

Note: Do not use an Atlassian API Token (generated at id.atlassian.com) — that token authenticates with Jira Cloud, Confluence Cloud, and Jira Align only, and will not work with Bitbucket. See Atlassian docs. Use a Bitbucket Repository Access Token or Workspace Access Token instead.
2. Configure Repository Variables
Before using the pipe, configure these repository variables in Repository Settings → Pipelines → Repository variables:BITBUCKET_ACCESS_TOKEN- Your Bitbucket Repository Access Token with write access
Basic Usage
Example 1: Basic Coverage Upload
Example 2: Pull Request Coverage Analysis
Example 3: Advanced Configuration with Debug Mode
Configuration Variables
| Variable | Required | Default | Description |
|---|---|---|---|
BITBUCKET_ACCESS_TOKEN | Yes | - | Bitbucket Repository Access Token for authentication (set as repository variable and pass as ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN in pipeline) |
COVERAGE_FILE | Yes | coverage.xml | Path to the coverage XML file (e.g., coverage.xml) |
API_BASE_URL | No | https://api.codeant.ai | CodeAnt AI API base URL (for self-hosted instances) |
PLATFORM | No | bitbucket | Git platform (github, gitlab, bitbucket) |
FAIL_ON_ERROR | No | true | Fail the build if coverage upload fails |
DEBUG | No | false | Enable debug logging |
Supported Coverage Formats
Important: Only XML format is supported for coverage reports.
- Cobertura XML (
.xml) - JaCoCo XML
Language-Specific Examples
Python with pytest
JavaScript with Jest
Java with Maven
Go with go-cover
Coverage Configuration
Python Coverage Configuration
Create a.coveragerc file in your project’s root folder to include all source files in the test coverage calculation:
., it checks for every Python file in the root folder and its subdirectories. You can omit directories by placing them in the omit section.
How It Works
- The pipe fetches the latest coverage upload script from CodeAnt AI
- Automatically decodes and prepares the script for execution
- Uploads your coverage report along with commit and repository information
- CodeAnt AI processes the report and provides analysis on your pull requests
- Lines executed by your tests are marked as “covered”
- Coverage percentage is calculated and status checks are performed on every push
Troubleshooting
Enable Debug Mode
SetDEBUG: 'true' to see detailed logs:
Coverage File Not Found
Issue: Coverage file not found error Solution: Ensure the coverage file is generated before upload and verify theCOVERAGE_FILE path is correct. Use artifacts to pass files between steps if needed.
Upload Fails But Pipeline Continues
Issue: Upload fails but pipeline continues Solution: SetFAIL_ON_ERROR: 'false' to continue the pipeline even if upload fails (default is true).
Authentication Errors
Issue: Authentication errors during upload Solution: Verify yourBITBUCKET_ACCESS_TOKEN is valid, has write access, and is marked as secured in Repository Variables.
Low Coverage Reporting
Issue: Coverage reporting is lower than expected Solution: Check your coverage configuration file (e.g.,.coveragerc), ensure all source files are included, and verify omit patterns aren’t excluding too much code.
Support
- 📧 Email: support@codeant.ai
- 📚 Documentation: https://docs.codeant.ai
- 🐛 Repository: https://bitbucket.org/codeantworkspace/codeant-coverage/src/main/