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

feat: unit testcases for increasing coverage #311

Closed
wants to merge 1 commit into from

Conversation

Sonichigo
Copy link

Hey, I’ve added new unit tests to the Go codebase while testing the capabilities of my Keploy AI testing agent. The tests ensure reliable coverage by validating code builds, eliminating flaky tests, and improving overall test stability. Here’s what the AI checks for:

  • Ensures new tests build without errors.
  • Confirms no flaky tests are introduced.
  • Enhances coverage for previously untested areas.

Coverage Breakdown:
Total Coverage Increased: 52.6% to 64.7%

Coverage Before:
image

Coverage Now:
image

Command to run for checking:

go test ./... -cover -coverprofile=coverage.out && go tool cover -func=coverage.out | tail -n 1

let me know if there is anything else I can add.

@yannh
Copy link
Owner

yannh commented Feb 16, 2025

Hi @Sonichigo ! Thank you for contributing. I use tests for added confidence when changing this codebase, to ensure there are no regressions. Code coverage is definitely a useful metric that can translate to confidence when changing the codebase - but not necessarily. Also, the time saved when writing those tests, I need to put in maintaining and reviewing - they don't come for free. While a number of tests here are valid, several others either do not bring meaningful confidence to me (output_test.go , for example) or do not follow existing testing patterns I am using (eg: validator_test.go) .

It would probably take me more time reviewing & maintaining those than it took you to generate them, so I'd rather skip. If there are specific areas of the code that you feel would really benefit from additional testing, I'd welcome targeted testing & smaller PRs. Thanks!

@yannh yannh closed this Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants