Skip to content
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

Feature/task-and-output-test-coverage #48

Open
wants to merge 104 commits into
base: main
Choose a base branch
from

Conversation

geneticsjesse
Copy link
Contributor

@geneticsjesse geneticsjesse commented Mar 6, 2024

Features

  • Adds wdl-ci coverage command to calculate and output task-level, workflow-level, and overall test coverage.

If there are any tasks or outputs with no tests, a warning is provided to the user, listing the relevant outputs and associated tasks. I left a ##TODO in here regarding optional inputs.

@geneticsjesse geneticsjesse requested a review from hkeward March 6, 2024 21:47
Copy link
Contributor

@hkeward hkeward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first pass.

The main issue I see is that this will miss outputs that have no tests defined, since we're relying on the config file to tell us what tasks and outputs to test.

Can you try reading through WDL files in the directory and using that to build out an idea of what outputs each task has, and which outputs are missing tests?

Then we'd want to get an understanding of % coverage, rather than the absolute number of tests for each output/task. i.e. so long as an output is covered by 1 test, we can say that it is 100% covered. If 3/4 outputs for a task have at least 1 test, that task has 75% test coverage.

Output could look something like this:

workflowNameA: 84% # this is the workflow coverage
  taskA: 75% # this is the task coverage
  taskB: 63%
  taskC: 100%
  taskD: 100%
workflowNameB: 100%
  taskA: 100%
  taskB: 100%
...
Total coverage 89% # this is the total coverage across all outputs from all tasks in all workflows

Task coverage = sum(# of task outputs with at least 1 test) / (# of task outputs)
Workflow coverage = sum(# of task outputs in all tasks with at least 1 test) / (# of task outputs in all tasks)

src/wdlci/cli/__main__.py Outdated Show resolved Hide resolved
geneticsjesse and others added 11 commits March 14, 2024 14:11
Instead of relying on the config file to tell us what tasks/outputs to test, the WDL files in the directory tell us what needs testing and then the config file is checked for associated tests. Currently, there are some edge cases that need handling; 1. Compound outputs and 2. Workflows from the custom_tests directory are included in the coverage calculation, which is not correct.
geneticsjesse and others added 26 commits December 13, 2024 18:13
…name; calculate task coverage using dict instead of list; add TODO
…er that resulted in confusing output

Previously, workflow_name_filter was being checked as part of the total coverage being returned; this was confusing as if it was set, a print message would tell the user there was no outputs to compute coverage for. It makes more sense to return coverage at all levels (task, workflow, and total) provided there are outputs to test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants