Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This quickstart shows you how to generate unit tests using GitHub Copilot App Modernization - upgrade for Java (preview).
Prerequisites
A GitHub account with GitHub Copilot enabled, using the Business or Enterprise plan.
The latest version of Visual Studio Code.
The latest version of the GitHub Copilot extension in Visual Studio Code.
GitHub Copilot App Modernization extension pack. For install instructions, see the next section.
This extension pack bundles the following two extensions:
- GitHub Copilot App Modernization for Java (preview)
- GitHub Copilot App Modernization - upgrade for Java (preview)
App Modernization doesn't require Java in your local environment. However, to build your project successfully, install the correct version of Java and Maven. We recommend the Microsoft Build of OpenJDK and Maven.
Installed versions of both the source and target JDKs.
A Git-managed Java project using Maven or Gradle.
For Maven-based projects: access to the public Maven Central repository.
Note
If you're using Gradle, only the Gradle wrapper version 5+ is supported. The Kotlin DSL isn't supported.
Sign in to use Copilot and then install the required extension
To use GitHub Copilot, sign in to your GitHub account in Visual Studio Code. Select the Copilot icon at the top of Visual Studio Code to access the GitHub Copilot pane. For more information about setting up GitHub Copilot, see Set up GitHub Copilot in VS Code.
Then, use the following steps to install the extension in Visual Studio Code:
- In Visual Studio Code, open the Extensions view from the Activity Bar.
- Search for GitHub Copilot App Modernization in the marketplace.
- Select the GitHub Copilot App Modernization extension pack.
- On the extension page, select Install.
- Restart Visual Studio Code.
After installation completes, you should see a notification in the corner of Visual Studio Code confirming success.
For more information, see Install a VS Code extension.
Launch GitHub Copilot Agent Mode and start the upgrade
Use the following steps to launch GitHub Copilot Agent Mode and generate unit tests:
- Select a Java project that uses either Maven or Gradle as its build tool.
- Open the selected Java project in Visual Studio Code.
- Open the GitHub Copilot Chat panel.
- Switch to Agent Mode.
- Enter a prompt such as Generate unit tests for this Java project.
Wait for the test generation to complete
The App Modernization - Upgrade for Java (Preview) tool analyzes the Java project within the current workspace. This includes evaluating the project's JDK version, build tools, and any existing unit tests.
As part of the process, the tool generates a TestReport.md file that tracks test generation progress and provides a summary of test results both before and after test generation. The report includes the following details:
- Total number of existing tests
- Overall pass rate
- Timestamp
- Number of successful tests
- Number of failed tests
- Number of tests with errors
During test generation, the output displays progress messages - for example, "Generating unit tests for ..." - to indicate ongoing activity. The tool automatically generates test files and adds them to the workspace.
Review the generated tests
After test generation is complete, GitHub Copilot displays a detailed report summarizing the post-generation test results. This report includes the same metrics captured before test generation - such as the total number of tests, successes, failures, and errors - enabling you to easily compare and evaluate the changes introduced during the process.
See also
GitHub Copilot App Modernization - upgrade for Java (preview)