flagger icon indicating copy to clipboard operation
flagger copied to clipboard

Offering help: Improving test coverage

Open erlapso opened this issue 1 year ago • 0 comments

markdown Hi everyone! I noticed a lot of Pull Requests, particularly in relation to new features and tests.

I'd like to help improve the test coverage using CodeBeaver, an AI agent that I built (it's free for open source!). To demonstrate what's possible, I've created a PR: https://github.com/CodeBeaverAI/flagger/pull/3 that adds comprehensive tests to the last Pull Request that was opened here: feat(gateway-api): Add custom backendRef and filters support for HTTPRoute.

What the PR demonstrates:

  • Increases coverage by 100.00% for pkg/apis/flagger/v1beta1/canary_test.go
  • Adds comprehensive tests for pkg/apis/flagger/v1beta1/canary_test.go, pkg/apis/flagger/v1beta1/zz_generated.deepcopy_test.go, and pkg/apis/gatewayapi/v1beta1/register_test.go
  • No bugs detected in your changes – great job!

On top of that: If you check the PR, you will see that CodeBeaver does not only go for coverage - it also adds all the edge cases it can think of (we make it iterate 3 times on that alone).

How it works:

CodeBeaver analyzes your code changes in PRs

  • Automatically generates and updates tests
  • Opens PRs with new/updated tests
  • Helps catch bugs before they reach production

Next steps

If this interests the maintainer team, I'm happy to:

  • Walk through how the tests were generated
  • Help set up automated test generation for future PRs (takes ~5 minutes)
  • Focus on specific areas you'd like to improve coverage for

Let me know what you think! Happy to adapt this approach based on the project's needs.


About CodeBeaver | Unit Test AI | AI Software Testing

erlapso avatar Mar 03 '25 15:03 erlapso