uuid: - value: 59cd5b64-d1c8-4249-ab41-2106e25df543 langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T09:00:28+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: | Is code coverage an objective or guideline? created: - value: '2023-11-02T00:00:00+00:00' changed: - value: '2025-05-11T09:00:28+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2023/11/02/is-code-coverage-an-objective-or-guideline langcode: en body: - value: |
Many development teams and projects use code coverage - e.g. how many lines of code are covered by automated tests - as an objective, and saying it must be 100% or another percentage.
But is this an effective metric?
In the same way as deleting failing tests to fix a pipeline, a code coverage amount can be faked.
With this in mind, what if, instead of setting an objective such as 100% code coverage, you used it as a guideline?
If you're working on a legacy project, what if you set a minimum code coverage amount as a guideline to ensure any new code has tests by not dropping under that level?
Would that be better than saying every line of code needs to be covered?
Code coverage is something I'm thinking of using more, so I want to know what you think.
format: full_html processed: |Many development teams and projects use code coverage - e.g. how many lines of code are covered by automated tests - as an objective, and saying it must be 100% or another percentage.
But is this an effective metric?
In the same way as deleting failing tests to fix a pipeline, a code coverage amount can be faked.
With this in mind, what if, instead of setting an objective such as 100% code coverage, you used it as a guideline?
If you're working on a legacy project, what if you set a minimum code coverage amount as a guideline to ensure any new code has tests by not dropping under that level?
Would that be better than saying every line of code needs to be covered?
Code coverage is something I'm thinking of using more, so I want to know what you think.
summary: null field_daily_email_cta: { }