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

Add parser for GoCov coverage #160

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

Conversation

rekathiru
Copy link

@rekathiru rekathiru commented Feb 24, 2025

This GoCov parser has been implemented in order to parse the unit tests coverage generated by the go underlying coverage tool(GoCov) with the command as below:

go test ./... -race -coverprofile=coverage.txt -covermode=atomic

Output from above command would be:

mode: atomic
github.com/dev/crd/pkg/aws/services.go:72.81,76.16 3 3
github.com/dev/crd/pkg/aws/services.go:76.16,77.41 1 2
github.com/dev/crd/pkg/aws/services.go:77.41,78.23 1 2

Where every line would have the coverage details as below:

domain_name/root_dir/repo/dir_path.../file_name:<start-line>.<start-column>,<end-line>.<end-column> <statement-count>  <execution-count>

So, the execution-count would say how many times the statements-count executed while running the tests. If the execution-count is above 1, then the statements-count has been executed at least once. So, we mark the start-line to end-line as covered. Otherwise, it will go into coverage miss.

Testing done

  • Relevant unit tests have been added.
  • Actively used by multiple projects in Intuit

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@rekathiru rekathiru changed the title adding go parser Add parser for Go coverage Feb 24, 2025
@rekathiru rekathiru changed the title Add parser for Go coverage Add parser for GoCov coverage Feb 24, 2025
@rekathiru rekathiru closed this Feb 25, 2025
@rekathiru rekathiru reopened this Feb 25, 2025
@uhafner uhafner added the feature New features label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants