Updated on 2026-09-15 GMT+08:00

IntelliJ IDEA

Preparations

Step 1: Install and Log In to the Plug-in

  1. Start IntelliJ IDEA. In its left navigation pane, click Plugins to access the Plugins page.
  2. Click Marketplace, enter CodeArts Agent in the search box, and press Enter.
  3. 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.

  4. After the installation is complete, click Restart IDE for the plug-in installation to take effect.
  5. Create a project. Note that you need to set Build system to Maven to run unit tests.

    Figure 1 Creating a project

  6. Click the icon in the sidebar to bring up the chat window.
  7. 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.

  1. Switch to the Agent mode.
  2. Enable AI-based automation.

    1. Click in the upper right corner to access the settings page.
    2. 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.

  3. 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.

  1. Right-click the code generated in Step 2: Create a Snake Game and choose CodeArts Agent > Generate Unit Tests (Agent).

    Figure 2 Choosing Generate Unit Tests (Agent)

  2. Wait until the GamePanelTest.java unit test file is generated, indicating that the test code is successfully executed and the test is passed.