IntelliJ IDEA
Preparations
- Visit the Huawei Cloud official website and register a Huawei Cloud account by referring to Signing Up for a Huawei Cloud Account.
- Download and install IntelliJ IDEA of a version from 2022.3 to 2026.1.
- Operating system: Windows 10 (x64, 2019 or later) or Windows 11 (x64)
Step 1: Install and Log In to the Plug-in
- Start IntelliJ IDEA. In its left navigation pane, click Plugins to access the Plugins page.
- Click Marketplace, enter CodeArts Agent in the search box, and press Enter.
- In the search result, find the plug-in and click Install.
If the
icon is displayed in the IntelliJ IDEA sidebar, the plug-in is successfully installed. - After the installation is complete, click Restart IDE for the plug-in installation to take effect.
- Create a project. Note that you need to set Build system to Maven to run unit tests. Figure 1 Creating a project
- Click the
icon in the sidebar to bring up the chat window. - Click HUAWEI ID Login. Your browser will launch automatically. Enter your HUAWEI ID and password to log in.
If you are using CodeArts Agent for the first time, the system will automatically activate the free package upon your successful login. If you want to unlock more advanced features, you can upgrade your package at any time from the Subscriptions page.
Step 2: Create a Snake Game
You can leverage the intelligent coding capabilities of CodeArts Agent to automatically generate the complete Java code for a Snake game, providing a code sample for subsequent unit tests.
- Switch to the Agent mode.
- Enable AI-based automation.
- Click
in the upper right corner to access the settings page. - Choose Dialog Flow > Agent > Auto-approve, and click
to enable the items required for automatic approval, including editing, browser access, and the web page content capture tool.
- Click
- Send your requirements to AI.
Develop a snake game in Java.
Step 3: Perform a Unit Test with the Agent
You can leverage unit testing capabilities to run automated verification on core project modules, effectively improving code quality and testing efficiency.
- Right-click the code generated in Step 2: Create a Snake Game and choose . Figure 2 Choosing Generate Unit Tests (Agent)
- Wait until the GamePanelTest.java unit test file is generated, indicating that the test code is successfully executed and the test is passed.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot