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

Improved unit-test coverage from 0 to 60+ with keploy AI-agent #744

Closed
wants to merge 2 commits into from

Conversation

TvisharajiK
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 Increase : 13%

File Coverage After
github.com/muety/wakapi/routes/relay 64.0%
github.com/muety/wakapi/helpers 50.4%

@muety muety self-requested a review February 18, 2025 18:05
Copy link
Owner

@muety muety left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! I'm being somewhat reluctant about this, though. While I appreciate the fact that you added tests, many of them are quite trivial. That's not a problem by itself, but what I particularly dislike about your contribution is the fact that code was generated by an AI. I might be old-fashioned in that regard, but letting an LLM run over a code base and contributing its output is not the purpose of open source in my opinion.

While I'll merge your PR (after you implemented the requested changes) for now, I'll probably update the contribution guidelines accordingly for the future.

}

// Mock implementation of SecureCookieDecoder for testing purposes.
type mockSecureCookie struct {
Copy link
Owner

Choose a reason for hiding this comment

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

Please don't mix mocks with actual application code. Perhaps put them inside the mocks directory? Testing code and business logic should be strictly separated.

Actually, I don't think the tests that make use of the mockResponseWriter are very sensible at all. They're super trivial and while I'd vote for testing actual application logic, I'm not a big fan of blowing up the code base just for the sake of test coverage. I'd probably get rid of the http_test.go entirely, sorry.

@TvisharajiK
Copy link
Author

Hey @muety

Noted, let me make the changes and do let me know if that would work

@muety
Copy link
Owner

muety commented Feb 24, 2025

Any updates on this?

@TvisharajiK
Copy link
Author

Hey Made the changes here, #753

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