-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Enhance documentation for coverage baseline in tests #9731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Added details on coverage baseline usage and its impact on test analysis.
Added ideal use cases and current constraints for adaptive testing.
| * Projects with comprehensive test coverage - The more thorough your tests, the more precisely adaptive testing can identify which tests are impacted by changes | ||
| * Test frameworks with built-in coverage support (Jest, pytest, Go test, Vitest) where generating coverage reports is straightforward | ||
|
|
||
| *Why coverage matters*: In codebases with sparse test coverage, adaptive testing cannot accurately determine which tests cover changed code. This causes the system to default to running all tests, negating the benefits of intelligent test selection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about
This causes the system to run more tests, reducing the benefits of intelligent test selection.
| |.circleci/example-baseline.info | ||
| |Path to a baseline coverage file to subtract from test coverage during analysis. + | ||
| Use this to exclude shared setup or initialization code from test impact data. + | ||
| The baseline file should be in the same format as your test coverage output (e.g., LCOV format for `<< outputs.lcov >>`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~~ Not strictly true, the baseline can be in any supported coverage format and we'll deal with it. There's no reason not to use the same format as test coverage output though.
|
|
||
| === Can I run analysis on branches other than main? | ||
|
|
||
| Yes! The branch behavior is fully customizable through your CircleCI configuration. While analysis typically runs on `main` by default, you can configure it to run on: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
While analysis runs on
mainby default, you can configure it to run on:
| . Any specific branch (for example, `develop` or `staging`). | ||
| . Multiple branches simultaneously. | ||
| . Feature branches if needed for testing. | ||
| . Scheduled pipelines independent of branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~~ Maybe . Scheduled pipelines is enough?
| * Vitest | ||
|
|
||
| The key requirement is that your test runner can generate coverage data in a parsable format (typically LCOV or similar). | ||
| The key requirement is that your test runner can generate coverage data in a parsable format (typically LCOV or similar). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now we can only read LCOV and Go's "legacy coverage" format.
| * Distributed test architectures where tests run against external services, separate containers, or multiple isolated contexts | ||
| * Limited coverage tooling for test frameworks that don't provide native instrumentation or coverage reporting | ||
| * Complex test configurations with non-standard test discovery, custom test runners, or unconventional project structures | ||
| * End-to-end tests that span multiple repositories or services, making it difficult to map code changes to specific tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll want to word these as things you test suite is constrained to do, rather than constrained not to do, e.g.:
=== Current Constraints
* Generating code coverage data is essential for determining how tests are related to code. If tests are run in a way that makes generating and accessing code coverage data tricky then adaptive testing may not be a good fit.
* Adaptive testing needs to be configured with commands to discover all available tests and run a subset of those tests. If you cannot run commands to discover tests and run a subset of tests on the CLI then adaptive testing may not be a good fit.
* Adaptive testing works best when testing a single deployable unit. A monorepo which performs integration tests across many packages at once may not be a good fit.
Added details on coverage baseline usage and its impact on test analysis.
Description
What did you change?
Reasons
Why did you make these changes?
Content Checklist
Please follow our style when contributing to CircleCI docs. Our style guide is here: https://circleci.com/docs/style/style-guide-overview.
Please take a moment to check through the following items when submitting your PR (this is just a guide so will not be relevant for all PRs):