Back to Blog Home

Automating tests and bug fixes with the Sentry extension for GitHub Copilot––because you have better things to do

Sarah Guthals image

Sarah Guthals -

Automating tests and bug fixes with the Sentry extension for GitHub Copilot––because you have better things to do

ON THIS PAGE

TL;DR: The Sentry extension for GitHub Copilot now goes beyond chat to help you generate tests, surface issues, and suggests fixes all within your regular PR workflow. Did you forget to write unit tests? Automatically generate them and merge them to your feature branch within GitHub. Have you already merged a PR? Catch new issues, get solutions to those bugs, and deploy those fixes quickly. Add the Sentry extension from the GitHub Marketplace to get started. 

Continue reading for more details and demos. 

With the latest update to the Sentry extension for GitHub Copilot, we’re bringing Sentry's code-level context and the latest GitHub Copilot Extensions capabilities to the pull request experience to help you automatically generate unit tests and fix production issues. Why should you care? Because just like how I didn’t write this blog from scratch, you don’t have to start from 0 anymore either – get a first cut of the tests you didn't write missed and even suggest actual fixes for a critical issue you simply don’t feel like debugging - without leaving your GitHub PR. 

Automate test generation

Decades later writing tests is still a controversial topic. Either you’re at a small start-up and don’t care about testing because you’re doing everything you can to close your next round or you’re a goliath of a business and the big bad boss is making everyone maintain at least 80% coverage. And even though we all know that having well-tested software is good for everyone, writing tests is apparently tedious. Luckily, this is arguably the best use case for AI. 

With the Sentry extension for GitHub Copilot, we automatically generate tests for the changes in your PR. You simply do the very obvious action and click  “Generate Unit Tests” on the Codecov PR Comment and robots will do the rest. Within seconds, it generates a full suite of tests that actually work. We’ll open a new branch with these new tests for you, all you have to do is merge the changes to your feature branch if you like them. If you need to make changes, check out the test branch, adjust the tests, and commit your updates. After you merge,  your CI process will restart, and Codecov will kick out a new coverage score– 🤞 it meets your team’s standard.

But as we all know generating tests is just the start. Even with the appropriate coverage, you can still break production. And oh boy does this part get fun – how bad is it, how many users, which release, which browser, what device, `git blame`,  the list goes on. And for the most part, this is pretty manageable because you use Sentry, right, right? But what if the PR you merged in last week starts causing issues?

Fix bugs fast, without leaving your PR

The same AI capabilities that generate tests for you can now help you identify the root cause and even suggest fixes without you ever having to leave GitHub. When Sentry detects an issue caused by a merged PR, the Sentry extension will comment on the original PR with a summary of the issue and a Root Cause button. Clicking that button adds another comment to the PR with a root cause analysis and another button offering to auto-fix the issue for you. Assuming you agree with the root cause analysis, clicking the Fix with Sentry button will add a final comment to the PR linking to a new PR with the autofix changes. Don’t worry, this is a Draft PR and you definitely should still review it (AI isn’t going to replace us THAT easily). Now, not only does the PR have a history of the impact of the issue, but you were able to identify, fix, and deploy with only a mouse and all within GitHub. (OK, you might have to type LGTM in the autofix PR review).

Let’s have fewer “It works on my machine”, and get back to actually building.

Get started with the Sentry extension for Copilot

Whether you’re using GitHub, VSCode, or Visual Studio, the Sentry extension update is now live and ready to use. Head to the GitHub Marketplace, add the extension, and start automating your test generation, contextualizing live issues affecting your users, and pushing out bug fixes, so that you can get back to coding faster. 

Give it a try, and let us know how it goes. You can share your feedback on GitHub or jump into the discussion on Discord.

Not an existing Sentry customer? Sign up free or request a demo to get started.

Share

Share on Twitter
Share on Bluesky
Share on HackerNews
Share on LinkedIn

Published

Sentry Sign Up CTA

Code breaks, fix it faster

Sign up for Sentry and monitor your application in minutes.

Try Sentry Free

Topics

Ecosystem

New product releases and exclusive demos

Don't just observe, debug

Listen to the Syntax Podcast

Of course we sponsor a developer podcast. Check it out on your favorite listening platform.

Listen To Syntax
© 2024 • Sentry is a registered Trademark of Functional Software, Inc.