Submind YouTube summaries
Thumbnail for Cursor + GitLab: Debugging Java Tests and Automating Code Review

Cursor + GitLab: Debugging Java Tests and Automating Code Review

Watch on YouTube

Video summary

In this introductory video from a series on integrating Cursor with GitLab, Michael, a principal developer at WorldCat, demonstrates how an AI-powered IDE can streamline the debugging of failing Java tests within a CI/CD pipeline. The scenario begins with a project where end-to-end tests are failing, triggering a warning in the pipeline configuration. To resolve this, Michael switches to Cursor and instructs its agent to analyze the issue, fix the code, and re-run the tests. The AI successfully identifies the root cause of the failure by examining the terminal output and the specific test command defined in the project's configuration, then applies the necessary corrections to make the tests pass locally. Once the local debugging is complete, the workflow transitions seamlessly into GitLab's version control and review processes. Michael asks Cursor to create a new git branch and generate a merge request, which the agent executes automatically using default templates. This action triggers a comprehensive suite of automated checks within GitLab, including dependency scanning, security analysis, container packaging, and smoke tests for the Rust backend. The video highlights how these pipelines run in parallel, ensuring that the code not only fixes the original bug but also adheres to security standards and architectural requirements before human review is required. The core value of this integration becomes evident during the code review phase, where GitLab Duo provides automated feedback on issues such as coding style violations and logic gaps in new branching strategies. Instead of manually addressing every comment, Michael demonstrates a modern workflow where he can ask Cursor to handle specific review feedback by triggering a developer flow. This allows the AI agent to run in the background, analyzing comments and implementing fixes while the developer continues working on other tasks, effectively creating an autonomous loop that accelerates the resolution of complex issues without constant manual intervention. The video concludes by summarizing how this synergy between Cursor and GitLab creates a continuous improvement cycle for software development. By combining local AI assistance with robust platform-level automation, developers can quickly identify and fix bugs, automate repetitive tasks like branch creation and pipeline execution, and efficiently address code review feedback. This approach not only speeds up the delivery of high-quality code but also reduces cognitive load by offloading routine debugging and compliance checks to intelligent agents. The presenter wraps up by teasing the next episode, which will focus on modernizing a legacy Java sensor written in Java 8, further showcasing the potential for AI tools to assist in maintaining and evolving existing codebases.
Read the full video transcript
Hello everyone, my name is Michael. I'm a principal developer at WorldCat here at GitLab. And in today's video, we want to dive into cursor and how it can work together with GitLab and GitLab 2 platform. In this first video of the series, um we will be using the Tanuki platform which is um which collects metrics, stores them in the back end and so on. specifically um as there is a sensor for collecting metrics written in Java and we can see here in the project the source code is there the CI/CD pipelines look a little bit odd so there is a warning um and when we start investigating the pipeline we can see the end to end test is failing and this is the use case for now let's investigate what's going on there and we can see the test is failing So we probably need to reproduce that locally. For that purpose I will switch into cursor now. Um and we can see it here. I already opened it. Um this is the IDE view. There is also an agent window in compos uh in in cursor version 3. But for now I will switch back to the um IDE. Um the test can be reproduced locally on that terminal here which I already ran but let's quickly run it again and see that the um unit tests are failing in that regard. So we can now start debugging that. For that purpose, I will switch to cursor on the right hand side here and say, can you help me fix the end to end tests in this project? Please um create an analysis first, then fix it and run the tests again. and then cursor starts with the analyzers checks the terminal um figures out the CI/CD pipelines which actually contains the um intent test that is failing. So we can see it on the left hand side over here. There is the YL configuration and the intent test um runs essentially that command which I just ran locally. It identified the root cause and wants to run the tests. So this looks good. Let's go ahead and test it ourselves again. trusting the agent here and we can see everything is good. So the next step here is to actually create a new branch um a git branch and then create a merge request. Can you create a git branch and merge request? Let's ask it. I could also do on the terminal um but I adopted that workflow for myself just now or in recent months. And we can see the merge request has been created um in that way. Let's quickly open that. Yes, I want to open that. I created that. It's also using the default merge request template. We can see the pipelines have been kicked off. uh there is code owners in place that require human review and approval and we can also see that GitLab Duo kicked off. So we will have a GitHub do a code review um using a flow in a bit and for that let's wait until everything is uh finished. Can see the pipelines here. Um there is also um dependency scanning going on. So there is let's quickly navigate into the pipeline so we can see what's actually going on. So dependency scanning we will build it um run the tests end to end test is supposed to be green now and we also have security scanning and later on package in a container and also some smoke tests for um writing into the rust back end until everything is finished. Um, let's speed up the recording. Pipeline is green or okay. Um, the test for end to end test um worked. Let's click on that and inspect it quickly. We can see the same result of the fixes. Um and when we go back into the merge request now um we can see the same here. So the next step is to um conduct a review. We already got review feedback from GitLab Duo here. Um it says to address the 200. Um, so it might need a little more changes on that and there is also a Java style guide feedback. Um, and the new branching logic should be covered by tests. So this is something to address and we can continue working on that. Um I can either bring that down to cursor again or one way I've um recently started using is ask do a developer which triggers the developer flow and say can you help address this review feedback but generally not in this um comment but down here. And when I comment here, it triggers a new session in the background runs in GitHub to agent platform and we can continue working on that fix um or we can continue working on something else that requires our attention and that revenue feedback is addressed by agents um running in the background whether it's single duentation platform or also offers that. Now to wrap it up here um what we've seen today is that um kurs was able to identify and analyze a problem of failing tests. So we have been working in the ID on the over here using the chat prompt fix the tests verify um verify I'm running create a merge request see the CI/CD pipelines running everything is okay and green um and automatically code review kicked in creating another workflow loop here um sharing um feedback that we can address with another agent and then continue working on things that require additional in uh attention. So, thanks for watching. Um yeah, and see you in the next video where we'll be looking into uh modernizing this Java collector and sensor because it's written in Java 8. See you next time. Bye-bye.